supplier table queries
SowmyRajJan 29 2009 — edited Jan 30 2009please anyone give me the answer of some questions for the following table
Ques. consider the supplier relation
********************S*******************
________________________________________
sno sname status city
s1 prentice hall 30 calcutta
s2 McGraw Hill 30 Mumbai
s3 Wiley 20 Chennai
s4 Pearson 40 Delhi
s5 Galgotia 10 Delhi
***********SP***********
________________________
sno pno quantity
s1 p1 300
s1 p2 200
s2 p1 100
s2 p2 400
s3 p2 200
s4 p2 200
q1 get supplier numbers for suppliers with status > 20 and city is delhi
q2 get supplier numbers and status for suppliers in delhi in descending order of status.
q3 get all pairs of supplier numbers such that the two suppliers are located in the same city.(hint : it is retrieval involving join of a table itself.)
q4 get unique supplier names for suppliers who supply part p2 without using IN operator.
q5 give the same query above by using the operator IN.
q6 get part numbers supplied by more than one supplier(hint : it is retrieval with sub query block, with inter block reference and same table involved in both blocks)
q7 get suppliers numbers for suppliers who supply part p1.(hint: retrieval using exists)
q7 get part numbers for parts whose quantity is greater than 200 or are currently supplied by s2.(hint: it is retrieval using union).
q8 suppose for the supplier s5 the value for status is nullinstead of 10. get supplier numbers for suppliers greater than 25.(hint: retrieval using null).
q9 get unique supplier numbers supplying parts.(hint: this query is using the built-in function count).
q10 for each part supplied, get the part number and the total quantity supplied for that part(hint: the query using GROUP BY).
q11 get part numbers for all parts supplied by more than one supplier.(hint: it is GROUP BY with HAVING).