Sie sind auf Seite 1von 4

1. Consider the following tables Product and Client.

Write SQL commands for the statement (i) to (v) Table: PRODUCT P_ID TP01 FW05 !01 !"0# FW1$ Table% C&I'NT C_ID 01 0# 1$ 15 1# Client Name alcum Powder %ace Wash &ath Soa( Sham(oo %ace Wash Cit( .elhi P_ID %W$' Product Name alcum Powder %ace Wash &ath Soa( Sham(oo %ace Wash Manufacturer Price L!" !&C !&C )*+ )*+ #$ #' '' 1,$ -'

/umbai &S$1 .elhi S0$1 .elhi %W1, &angalore P$1

)i* To di+,la( t-e detail+ of t-o+e Client+ .-o+e cit( i+ Del-i/ )ii* To di+,la( t-e detail+ of Product+ .-o+e Price i+ in t-e ran0e of 50 to 100) ot- 1alue+ included*/ )iii* To di+,la( t-e ClientName2 Cit( from table Client2 and ProductName and Price from table Product2 .it- t-eir corre+,ondin0 matc-in0 P_ID/ )i1* To increa+e t-e Price of all Product+ b( 10 )1* To di+,la( t-e ma3imum and minimum ,rice+ for eac- manufacturer/

$/ Consider the following tables Consignor and Consignee. Write SQL command for the statements(i)to(v) T4 &' % CON!I5NOR CnorID CnorName Cnor4ddre++ ND01 ND0$ MU15 MU50 T4 &' % CON!I5N'' CneeID CnorID CneeName Cnee4ddre++ CneeCit( MU05 5.$1 2ahul"ishore '3Par: !venue /umbai 117;3/oore ND06 5.$, P .hingr a 5ew .elhi 4nclave ,!3Central7 7O18 /<1' ! P 2o= "ol:ata avenue P ,#'3 !& MU9$ 5.$ , S mittal /umbai Colon= 163&loc: ND:6 /<' $ & P ;ain 5ew .elhi d3a3viha )i* o dis(la= the names of all consignors from /umbai. )ii* o dis(la= the cnee>.3 cnor5ame3 cnor!ddress3 Cnee5ame3 Cnee!ddress for ever= Consignee. )iii* o dis(la= the consignee details in ascending order of Cnee5ame. )i1* o dis(la= number of consignors from each cit=. )1* o dis(la= the consignee who are not located in /umbai or "ol:ata Cit( 5ew 2 singhal ,#3!&C 4nclave .elhi 1,63Palm 5ew !mit"umar !venue .elhi 2 "ohil '7!3South3Street /umbai S "aur 89"3Westend /umbai

Write the SQL commands for (i) to (vii) on the basis of the table SP?2 S T4 &'% !PORT! !tudno 10 11 1$ 19 1: 15 Cla++ Name 5ame1 5rade1 5ame$ 5rade$ 8 Smeer Cri:et & Swimming ! @ Su;it ennis ! S:ating C 8 "amala Swimming & %ootball & 8 Aeena ennis C ennis ! !rchana &as:etball ! Cric:et ! 1$ !r(it Cric:et ! !thletics C

)i* .is(la= the names of the students who have grade BCC in either Dame1 or Dame, or both. 4n+% Select 5ame %rom S(orts Where Drade1EFCF ?2 Drade,EFCF )ii* .is(la= the number of students getting grade B!C in Cric:et. 4n+% Select Count(G) from S(orts Where (Dame1EFCric:etF and Drade1EF!F) or (Dame,EFCric:etF and Drade,EF!F) )iii* .is(la= the names of the students who have same game for both game1 and game, 4n+% Select 5ame %rom S(orts Where Dame1EDame, )i1* .is(la= the games ta:en u( b= the students3 whose name starts with B!C.

4n+% Select Dame13Dame, %rom S(orts Where 5ame Li:e H!IF )1* !dd a new column named Bmar:sC. 4n+% !lter able S(orts !dd /ar:s 5umber(')J )1i* !ssign a value ,$$ for mar:s for all those who are getting grade B&C or B!C in both Dame1 and Dame,. 4n+% (Children3 r= his !nswer as an assignment) )1ii* !rrange the whole table in the al(habetical order of name. 4n+% Select G from S(orts ?rder &= 5ame

Das könnte Ihnen auch gefallen