MySQL Tables
MySQL Tables
ii. To display code, Item name and City of the products whose
quantity is less than 100.
1
iv. To insert a new row in the table Shoppe
2
vii. SELECT MIN(Qty) from Shoppe
WHERE City=”Mumbai”;
3
Table - 2
Q2. Observe the table given below (EMPLOYEE)
Write command of SQL for (i) to (vi) and output for (vii) to (viii).
4
(iii) To display the name of the employee having unique branch.
(iv) To display the name and em_id of the employee having the least
date of joining.
5
(vii) SELECT BRANCH,MAX(SALARY) FROM EMPLOYEE GROUP BY
BRANCH HAVING DOJ<=2018-18-18.
6
Table - 3
(i) To list the names and age of female patients who are in
orthopaedic department.
7
(iii) Delete the records of all female patients in Surgery department.
(iv) Display the details of all the patients who are hospitalised in
1998.
8
(vi) SELECT MAX(Age) FROM Hospital WHERE Sex = ‘M’;
9
Table - 4
Q4. Observe the table given below (PharmaDB)
Write command of SQL for (i) to (vi) and output for (vii) to (viii).
(ii) To display all those medicines whose price is in the range 100 to
150.
10
(iii) To display the Maximum price offered by pharmacy located
“Gurgaon”.
(iv) To display the Drug ID, DrugName and Pharmacy Name of all
therecords in descending order of their price.
11
(vi) To display all the pharmacy whose drugs costs less than the
average.
12
Table - 5
Q5. Observe the table given below (GYM)
Write command of SQL for (i) to (iv) and output for (v) to (viii).
(i) To display the names of all the items whose name starts with A.
13
(iii) To change the Brandname to "Fit Trend India" of the item, whose
ICODE as "GIO1".
(iv) Add a new row for a new item in GYM with the details:
"G107","Vibro exerciser",21000,"GTCFitness".
14
(vi) SELECT MAX(PRICE) FROM GYM;
15
Table - 6
Q6.Observe the table given below (DEVICES)
Write command of SQL for (i) to (iv) and output for (v) to (viii).
EmpID Name Device Salary HiringDate
DC242 ABHISHEK HP 80000 2018-03-12
UPMANYU ELITEBOOK
DB922 ANUBHAV BASSI MACBOOK 82000 2017-11-16
PRO
DA042 BISWA KALYAN ASUS 78000 2015-07-21
RATH ZENBOOK
DE916 SAMAY RAINA ACER 79000 2019-07-18
TRITON
DC333 SUMIT SAURAV ROG 75000 2019-08-23
ZEPHYRUS
DF007 TANMAY BHAT HP OMEN 75000 2018-09-20
DB200 ZAKIR KHAN MACBOOK 85000 2015-04-05
AIR
16
(iii) To display Name and Device of employees.
17
(vi) SELECT MAX(Salary) FROM DEVICES;
18
Table - 7
Q7.Observe (TABLE.7) the table given below (WORKER)
Write command of SQL for (i) to (iv) and output for (v) to (viii).
ii. To insert a new tuple with the data (008, Geethika, 74000, 2016-
12-24, ADMIN).
19
iii. To display the details of all the workers of HR department.
20
vi. SELECT DISTINCT(Department) FROM WORKER;
21
Table - 8
ii. To display Mcode, Mname, Age of all female members of the Gym
with age in descending order.
22
iii. To list names of members and their date of admission of those
members who joined after 31st December, 2015.
iv. To display the Mname, FeeGiven of all those members of the Gym
whose age is less than 40 and are monthly type members of the
Gym.
23
vi. To display types of memberships available. Duplicate values should
not be displayed.
24
Table - 9
Q9. Observe the table given below (PEOPLE)
Write command of SQL for (i) to (iv) and output for (v) to (viii):
ii. Display the People IDs (PID), Cities and PinCode of people in
descending order of PinCode.
25
iii. Display the First_Name and City of all the females getting
Basic_salaries above 40000.
26
vi. SELECT SUM (Basic_Salary) FROM PEOPLE
WHERE Gender = ‘F’;
27
Table - 10
Q10. Observe the table given below (Bank)
Write command of SQL for (i) to (iv) and output for (v) to (viii):
28
iv. To display all the details from table “Bank”, whose date of
open is between ‘2011-01-01’ and ‘2011-12-31’.
29
vii. SELECT COUNT(DISTINCT Transaction ) FROM Bank ;
**************
30
31