Friday, October 3, 2008

Welcome to my Page

Database theory encapsulates a broad range of topics related to the study and research of the theoretical realm of databases and database management systems.

Table (Database)

In relational databases and flat file databases, a table is a set of data elements (values) that is organized using a model of vertical columns (which are identified by their name) and horizontal rows. A table has a specified number of columns, but can have any number of rows. Each row is identified by the values appearing in a particular column subset which has been identified as a candidate key. Table is another term for relations; although there is the difference in that a table is usually a multi-set (bag) of rows whereas a relation is a set and does not allow duplicates. Besides the actual data rows, tables generally have associated with them some meta-information, such as constraints on the table or on the values within particular columns. The data in a table do not have to be physically stored in the database. Views are also relational tables, but their data are calculated at query time. Another example are nicknames, which represent a pointer to a table in another database.

Tables of Database Laboratory Exercises


tblmeals








tblorders















tblpartof







tblstores







tblvendor









tblmadewith
















tblingredients








tblads














tblmeals








tblmenuitems













Code and Result of the Database Laboratory Exercises




Query 1:
SELECT name
FROM tblingredients, tblvendor
WHERE tblingredients.vendorid = tblvendor.vendorid and companyname='veggies_r_us';











Query 2:
SELECT tblstores.storeid, price
FROM tblorder, tblstores
WHERE tblorder.storeid = tblstores.storeid and state = 'CA';
















Query 3:
SELECT state, sum(price)
FROM tblstores, tblorder
WHERE tblstores.storeid = tblorder.storeid
GROUP BY state;











Query 4:
SELECT v.vendorid AS ["Vendor ID"], name
FROM tblingredients AS i, tblvendor AS v
WHERE i.vendorid = v.vendorid and v.companyname in ('veggies_r_us', 'spring water supply')
ORDER BY v.vendorid;














Query 5:

SELECT DISTINCT mi.name, price
FROM tblingredients AS i, tblvendor AS v, tblitems AS mi, tblmadewith AS mw
WHERE i.vendorid = v.vendorid and i.ingredientid = mw.ingredientid and mw.itemid = mi.itemid and companyname = 'veggies_r_us';











Query 6:

SELECT tblvendor.vendorid, name, companyname
FROM tblingredients, tblvendor
WHERE tblingredients.vendorid = tblvendor.vendorid;













Query 7:

SELECT companyname, max(price) AS totalprice
FROM tblingredients AS i, tblvendor AS v, tblitems AS mi, tblmadewith AS mw
WHERE i.vendorid = v.vendorid and i.ingredientid = mw.ingredientid and mw.itemid =mi.itemid
GROUP BY v.vendorid, companyname;













Query 8:

SELECT DISTINCT (companyname)
FROM tblingredients AS i, tblvendor AS v, tblitems AS mi, tblmadewith AS mw
WHERE i.vendorid = v.vendorid and i.ingredientid = mw.ingredientid and mw.itemid = mi.itemid and mi.name = 'Fruit Plate';














Query 9:

SELECT v2.companyname
FROM tblvendor AS v1, tblvendor AS v2
WHERE v1.vendorid = v2.referredby and v1.companyname = 'veggies_r_us';











Query 10:

SELECT i.name, m.name
FROM tblitems AS i, tblmeals AS m, tblpartof AS p
WHERE i.itemid = p.itemid and p.mealid = m.mealid;













Query 11:
SELECT i.name
FROM tblingredients AS i, tblmadewith AS mw
WHERE i.ingredientid = mw.ingredientid and inventory = quantity;










Query 12:
SELECT ingredientid
FROM tblingredients, tblvendor
WHERE name = companyname;








Query 13:
SELECT *
FROM tblmeals, tblpartof;










Query 14:
SELECT m.name AS meal, i.name AS item
FROM tblmeals AS m, tblpartof AS p, tblitems AS i
WHERE m.mealid = p.mealid and i.itemid = p.itemid;












Query 15:
SELECT *
FROM tblmeals AS m1, tblmeals AS m2;








Query 16:
SELECT m.name AS meal, i.name AS item
FROM tblmeals AS m, tblpartof AS p, tblitems AS i
WHERE i.itemid = p.itemid;
















Query 17:
SELECT tblitems.name, ing.name
FROM tblitems, tblmadewith AS mw, tblingredients AS ing
WHERE tblitems.itemid = mw.itemid and mw.ingredientid = ing.ingredientid and (3*mw.quantity>ing.inventory);











Query 18:
SELECT a.name
FROM tblitems AS a, tblitems AS q
WHERE (a.price>q.price and q.name = 'Garden Salad');














Query 19:
SELECT DISTINCT (i.name) AS name
FROM tblitems AS a, tblitems AS q, tblmadewith AS m, tblingredients AS i
WHERE (((a.price)>q.price) And ((q.name)='Garden Salad') And ((i.ingredientid)=m.ingredientid) And ((m.itemid)=a.itemid));
















Query 20:
SELECT i1.name, count(*) AS rank
FROM tblingredients AS i1, tblingredients AS i2
WHERE (i1.name >= i2.name)
GROUP BY i1.ingredientid, i1.name;
















Query 21:
SELECT name
FROM tblingredients AS i INNER JOIN tblvendor AS v ON i.vendorid = v.vendorid
WHERE v.companyname= 'veggies_r_us';














Query 22:
SELECT i1.name
FROM tblitems AS i1 INNER JOIN tblitems AS i2 ON i1.price>i2.price
WHERE i2.name = 'Garden Salad';














Query 23:
SELECT companyname, i.vendorid, i.name
FROM tblvendor AS v INNER JOIN tblingredients AS i ON v.vendorid = i.vendorid;















Query 24:
SELECT *
FROM tblmeals INNER JOIN tblpartof ON tblmeals.mealid = tblpartof.mealid;






Love
is any of a number of emotions and experiences related to a sense of strong affection. The word love can refer to a variety of different feelings, states, and attitudes.

Broken Hearted
is a common metaphor used to describe the intense emotional pain or suffering one feels after losing a loved one.

Friendship is a term used to denote co-operative and supportive behavior between two or more beings. In this sense, the term connotes a relationship which involves mutual knowledge, esteem, and affection and respect along with a degree of rendering service to friends in times of need or crisis. Friends will welcome each other's company and exhibit loyalty towards each other, often to the point of altruism. Their tastes will usually be similar and may converge, and they will share enjoyable activities. They will also engage in mutually helping behavior, such as exchange of advice and the sharing of hardship. A friend is someone who may often demonstrate reciprocating and reflective behaviors. Yet for many, friendship is nothing more than the trust that someone or something will not harm them.













Idol doing their thesis..














Speedy taking a bath..


Favorite Song

Grow Old With YOU
(Adam Sandler)

I wanna make you smile whenever youre sad
Carry you around when your arthritis is bad
All I wanna do is grow old with you

Ill get your medicine when your tummy aches
Build you a fire if the furnace breaks
Oh it could be so nice, growing old with you

Ill miss you
Ill kiss you
Give you my coat when you are cold

Ill need you
Ill feed you
Even let ya hold the remote control

So let me do the dishes in our kitchen sink
Put you to bed if youve had too much to drink
I could be the man who grows old with you
I wanna grow old with you