MY SQL
WORKSHEET QUESTIONS
Q24) Rakesh created a table in MySQL. Later he found that table is
wrongly created, and he wants to remove it. Name the command by
which Rakesh can do it.
Q25) Reena created a table named student, she wants to see those
students whose name ending with ‘p’ She wrote a query-
SELECT name. * FROM student WHERE name=”p%”;
Help Reena to run the query by removing the errors from the query and
rewriting it.
Q54) Write a SQL command to create the following table ‘MCA’ with
MNO as Primary key and Fee and Semester with NOT NULL constraints.
TABLE: MCA
MNO Name Address Join_ DT Fee Semester Grade
1001 ADITYA B-4, DWARKA 2007-07- 4500 I A1
23
1234 `KOMAL SEC 5, R.K PURAM 2009-06- 500 III B2
15
5678 ANUSHIKA B3/2, V. VIHAR 2008-06- 7000 I C1
22
9854 HIMANSHU SEC 2, PUNA 2009-03- 8000 II B2
13
3265 MUMTA 123/A, MUMBAI 2013-02- 4500 I A2
17
4512 PRERNA 53/2, 2008-05- 6500 III C3
CHANDIGARH 10
7645 AMIT 11/7, CHENNAI 2010-05- 10000 II B1
25
9054 SUMIT 117-N, DELHI 2008-3-27 10500 III A2
8326 REKHA 56/E, 2012-04- 7600 I C2
AHEMADABAD 12
7324 SAVITRI 73/C, FARIDABAD 2013-06- 8700 I C1
15
Write SQL query for the following based on table ‘MCA’
(i) To display Name, MNO of those students who joined after year 2010.
(ii) To display all the information in Descending order of MNO.
(iii) To add record with the following data:
8320, “AMIT”, “0G2-8, MALVIYA NAGAR”, “2010-07-12”, 6700, “II”,
“A1”
(iv) To count unique SEMESTER numbers in given table.
(v) To add new column REMARKS of data type VARCHAR of size 20.
(vi) To change the FEE of AMIT from 10000 to 7000.
Q67) Consider the following table FITNESS with details about fitness
products being sold in the store. Write command of SQL for (i) to (iv)
and output for (v) to (vii).
Table: FITNESS
PCODE PNAME PRICE MANUFACTURER
P1 Treadmill 21000 Coscore
P2 Bike 20000 Aone
P3 Cross Trainer 14000 Reliable
P4 Multi Gym 34000 Coscore
P5 Massage chair 5500 Regrosene
P6 Belly Vibrator Belt 6500 Ambaway
To display the names of all the products with price more than 20000.
To display the names of all products by the manufacturer “Aone”.
To change the price data of all the products by applying 25% discount
reduction.
To add a new row for product with the details: “P7”, “Vibro Exerciser”,
28000, ”Aone”.
SELECT * FROM FITNESS WHERE MANUFACTURER LIKE “%e”;
(vi) SELECT COUNT (DISTINCT (MANUFACTURER)) FROM
FITNESS;
(vii) SELECT MAX (PRICE) FROM FITNESS;