Page 300 - PYTHON-12
P. 300
(c) For the given table, do as directed:
Table: STUDENT
Column name Data type size Constraint
ROLLNO Integer 4 Primary Key
SNAME Varchar 25 Not Null
GENDER Char 1 Not Null
DOB Date Not Null
FEES Integer 4 Not Null
HOBBY Varchar 15 Null
(i) Write SQL query to create the table.
(ii) Write SQL query to increase the size of SNAME to hold 30 characters.
(iii) Write SQL query to remove the column HOBBY.
(iv) Write SQL query to insert a row in the table with any values of your choice that can be
accommodated there.
27. Write SQL queries based on the following tables:
PRODUCT:
P_ID ProductName Manufacturer Price Discount
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45 5
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120 10
FW12 Face Wash XYZ 95
CLIENT:
C_ID ClientName City P_ID
01 Cosmetic Shop Delhi TP01
02 Total Health Mumbai FW05
03 Live Life Delhi BS01
04 Pretty Woman Delhi SH06
05 Dreams Delhi FW12
(i) Write SQL Query to display ProductName and Price for all products whose Price is in the range 50 to
150.
(ii) Write SQL Query to display details of products whose manufacturer is either XYZ or ABC.
(iii) Write SQL query to display ProductName, Manufacturer and Price for all products that are not giving
any discount.
(iv) Write SQL query to display ProductName and price for all products whose ProductName ends with ‘h’.
(v) Write SQL query to display ClientName, City, P_ID and ProductName for all clients whose city is Delhi.
28. Answer the question based on the table given below:
(vi) Which column is used as Foreign Key and name the table where it has been used as Foreign key.
Computer Science with Python–XII 12.70 SL.No. Name Age Department Dateofadm Charges Sex
Table: HOSPITAL
62
Surgery
M
300
21-01-98
Arpit
1
250
12-12-97
ENT
2
22
F
Zareena
3
200
19-02-98
M
32
Kareem
Orthopedic
M
4
300
Arun
12
Surgery
11-01-98
5
M
12-01-98
30
ENT
250
Zubin