AMITY INTERNATIONAL SCHOOL, SECTOR -1 , VASUNDHARA
SESSION 2021 – 22
CLASS XII
DATABASE MANAGEMENT (MYSQL) – PRACTICAL QUESTIONS
1) The given table “Tutor” is shown below , write commands to do the following :
ID NAME AGE CITY FEE PHONE
P1 SAMEER 34 DELHI 45000 9811076656
P2 ARYAN 35 NAGARKOT 54000 9911343989
P4 RAM 34 CHENNAI 45000 9810593578
P6 PREMLATA 36 BHOPAL 60000 9910139987
P7 SHIKHA 36 RAJKOT 34000 9912139456
P8 RADHA 33 DELHI 23000 8110668888
(i) Display name in descending order of those students whose age does not lie between 35 and 40.
(ii) List cities with their average fee in it.
iii) Decrease the fees of shikha by 5%
iv) Display cities where fees is maximum and minimum respectively
v) Display the name and city of tutor who lives in a city with name having ‘O’ but not ‘P’
2. Consider the following WATCHES and SALE table and Write the command in MYSQL for (i)
to (v):
Table: WATCHES
Watchid Watch_Name Price Type Qty_Store
W001 High Time 10000 Unisex 100
W002 LifeTime 15000 Ladies 150
W003 Wave 20000 Gents 200
W004 High Fashion 7000 Unisex 250
W005 Golden Time 2500 Gents 100
Table: SALE
WatchId Qty_Sold Quarter
W001 10 1
W003 5 1
W002 20 2
W003 10 2
W001 15 3
W002 20 3
W005 10 3
W003 15 4
a) To display watch name and their quantity sold in first quarter.
b) To display the details of those watches whose name ends with ‘Time’?
c) To display total quantity in store of Unisex type watches.
d) To display watch’s name and price of those watches which have price range in between
5000-15000.
e) To display Quantity sold of all watches WatchId wise.
(DATABASE MANAGEMENT through Python code (MySQL- Python connectivity))
1. Consider the table “ITEM” having the following fields
Itemcode varchar
Itemname varchar
Price float
i) Create the table ITEM in the mydb database
ii) Create a menu driven program in python to have
a) function for inserting records in the table
b) function for displaying all the records from the table item
c) Function for searching for a particular record on basis of Itemcode
2. Create a Table “STUDENT” in MySQL with the following attributes.
Table: STUDENT
ColumnName Datatype Size Constraint
RollNo Number Primary Key
Name Varchar 30 Not Null
Class Number
DOB Date
Gender Varchar 2
i) Create a menu driven program in Python for the user to enter the details and save the
data in MySQL table
ii) Allow the user to update the details for a particular rollno and ensure the changes have
been made in the table student.
3. Create a Table “BUS” in MySQL with the following attributes.
Table: BUS
ColumnName Datatype Constraint
BusNo Number Primary Key
Origin Varchar
Dest Varchar
Rate Number
Km Number
Now build a connection with Python to add a new record and Display the details in above table. You
may use Tkinter to create the front end.
**********************************************************************************