Post on 04-Jun-2018
8/13/2019 sqlrecord.doc
http://slidepdf.com/reader/full/sqlrecorddoc 1/4
1. Consider the following tables Product and Client. Write SQL commands for thestatement (i) to (v)
Table: PRODUCT
P_ID ProductName
Manufacturer Price
TP01alcumPowder
L!" #$
FW05%aceWash
!&C #'
!01&athSoa
!&C ''
!"0# Shamoo *+ 1,$
FW1$%aceWash
*+ -'
Table% C&I'NT
C_IDClientName
Cit( P_ID
01alcumPowder
elhi %W$'
0# %ace Wash /umbai &S$1
1$ &ath Soa elhi S0$
15 Shamoo elhi %W1,
1# %ace Wash &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 rane of 50 to100)ot- alue+ included*/
)iii* To di+,la( t-e ClientName2 Cit( from table Client2 and ProductName and Pricefrom table Product2 .it- t-eir corre+,ondin matc-in P_ID/
)i* To increa+e t-e Price of all Product+ b( 10
)* To di+,la( t-e ma3imum and minimum ,rice+ for eac- manufacturer/
8/13/2019 sqlrecord.doc
http://slidepdf.com/reader/full/sqlrecorddoc 2/4
$/ Consider the following tables Consignor and Consignee. Write SQL command for thestatements(i)to(v)
T4&' % CON!INOR
CnorID CnorName Cnor4ddre++ Cit(
ND01 2 singhal ,#3!&C 4nclave5ewelhi
ND0$ !mit"umar 1,63Palm !venue 5ewelhi
MU15 2 "ohil '7!3South3Street /umbai
MU50 S "aur 89"3Westend /umbai
T4&' % CON!IN''
CneeID CnorID CneeName Cnee4ddre++ CneeCit(
MU05 5$1 2ahul"ishore '3Par !venue /umbai
ND06 5$, P hingr a17;3/oore4nclave
5ew elhi
7O18 /<1' ! P 2o=,!3Central7avenue
"olata
MU9$ 5$ , S mittalP ,#'3 !&Colon=
/umbai
ND:6 /<' $ & P ;ain163&locd3a3viha
5ew elhi
)i* o disla= the names of all consignors from /umbai.
)ii* o disla= the cnee>3 cnor5ame3 cnor!ddress3 Cnee5ame3 Cnee!ddress for ever=Consignee.
)iii* o disla= the consignee details in ascending order of Cnee5ame.
)i* o disla= number of consignors from each cit=.
)*o disla= the consignee who are not located in /umbai or "olata
8/13/2019 sqlrecord.doc
http://slidepdf.com/reader/full/sqlrecorddoc 3/4
Write the SQL commands for (i) to (vii) on the basis of the table SP?2S
T4&'% !PORT!
!tudno Cla++ Name ame1 rade1 ame$ rade$
10 8 Smeer Criet & Swimming !
11 @ Su;it ennis ! Sating C
1$ 8 "amala Swimming & %ootball &
19 8 Aeena ennis C ennis !
1: - !rchana &asetball ! Cricet !
15 1$ !rit Cricet ! !thletics C
)i* isla= the names of the students who have grade BC in either Dame1 or Dame, orboth.
4n+% Select 5ame %rom Sorts Where Drade1EFCF ?2 Drade,EFCF
)ii* isla= the number of students getting grade B! in Cricet.
4n+% Select Count(G) from Sorts Where (Dame1EFCricetF and Drade1EF!F) or(Dame,EFCricetF and Drade,EF!F)
)iii* isla= the names of the students who have same game for both game1 andgame,
4n+% Select 5ame %rom Sorts Where Dame1EDame,
)i* isla= the games taen u b= the students3 whose name starts with B!.
8/13/2019 sqlrecord.doc
http://slidepdf.com/reader/full/sqlrecorddoc 4/4
4n+% Select Dame13Dame, %rom Sorts Where 5ame Lie H!IF
)* !dd a new column named Bmars.
4n+% !lter able Sorts !dd /ars 5umber(')J
)i* !ssign a value ,$$ for mars for all those who are getting grade B& or B! in bothDame1 and Dame,.
4n+% (Children3 r= his !nswer as an assignment)
)ii* !rrange the whole table in the alhabetical order of name.
4n+% Select G from Sorts ?rder &= 5ame