11, "Aftab", 24, "Surgery". (25/02/98), 300, "M"
11, "Aftab", 24, "Surgery". (25/02/98), 300, "M"
1 Write SQL commands for (i) to (vii) and write the outputs for (vii) on the 1998
basis of table HOSPITAL.
No Name Age Department Dateofadmit Charges Sex
1 Arpit 62 Cardiology 21/01/98 300 M
2 Zafrina 22 ENT 12/12/97 250 F
3 Kareem 32 Dentistry 19/02/98 200 M
4 Arun 12 Cardiology 11/01/98 300 M
5 Zubin 30 ENT 12/01/98 250 M
6 Ketika 16 ENT 24/02/98 250 F
7 Ankita 29 Surgery 20/02/98 800 F
8 Zareen 45 Cardiology 22/02/98 300 F
9 Kush 19 Surgery 12/01/98 800 M
10 Shilpa 23 Skin 21/02/98 400 F
(vii) Give the output of the following queries based on the above tables :
SELECT COUNT(DISTINCT Publishers) FROM Books
SELECT SUM(Price) FROM Books WHERE Quantity >5
SELECT Book_Name, Author_Name FROM Books WHERE Price<500
SELECT COUNT (*) FROM Books
07. (b) Consider the following tables EMPLOYEES and EMPSALARY. Write SQL
commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).
2005
(i) To display Firstname, Lastname, Address and City of all employees living in
Paris from the table EMPLOYEES.
(ii) To display the content of EMPLOYEES table in descending order of
FIRSTNAME.
(iii) To display the Firstname, Lastname, and Total Salary of all Managers from
the tables EMPLOYEES and EMPSALARY, where Total Salary is calculated as
Salary + Benefits.
(iv) To display the Maximum salary among Managers and Clerks from the table
EMPSALARY.
08. (b) Consider the following tables. Write SQL commands for the statements (i) to (iv) and
give outputs for SQL queries (v) to (viii) 2007
09.(b) Consider the following tables GARMENT and FABRIC. Write SQL commands for
the statements (i) to (iv) and give outputs for (v) to (viii). 2009
(ii) To display the details of all the GARMENTs, which have READYDATE in
between 08-DEC-07 and 16-JUN-08 (inclusive of both the dates).
(iii) To display the average PRICE of all the GARMENTs, which are made up of
FABRIC with FCODE as F03.
(iv) To display FABRICwise highest and lowest price of GARMENTs from GARMENT
table. (Display FCODE of each GARMENT along with highest and lowest price).
(i) To display details of all the items in the Store table in ascending order of
LastBuy.
(ii) To display ItemNo and Item name of those items from Store table Whose Rate
is more than 15 Rupees.
(iii)To display the details of those items whose Suppliers code (Scode) is 22 or
Quantity in Store (Qty) is more than 110 from the table Store.
(iv) To display Minimum Rate of items for each Supplier individually as per
Scode from the table Store.
Give the output of the following SQL queries:
(i) SELECT COUNT (DISTINCT Scode) FROM Store;
(ii) SELECT Rate*Qty FROM Store WHERE ItemNO = 2004;
(iii)SELECT Item, Sname FROM Store S, Suppliers P WHERE S.Scode = P.Scode AND
Item No = 2006 ;
(iv) SELECT MAX (LastBuy) FROM Store ;
11.(b)Consider the following tables WORKER and PAYLEVEL and answer the given
questions. 2011
Write SQL commands for the following statements:
(i) To display the details of all WORKERs, descending order of DOB.
(ii) To display NAME and DESIG of those WORKERs whose PLEVEL is
either P001 or P002.
(iii)To display the content of all the WORKERs table, whose DOB is in
between „19-JAN-1984‟ and 18-JAN-1987‟.
(iv) To add a new row with the following :
19, „Days Kishore‟, „Operator‟, „P003‟. „19-Jun-2008‟, „11-Jul-1984‟
14. (b) Consider the following tables ACTIVITY and COACH. Write SQL commands for
the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)
SP2
(i) To display the name of all activities with their Acodes in descending order.
(ii) To display sum of PrizeMoney for each of the Number of participants groupings (as
shown in column ParticipantsNum 10,12,16)
(iii) To display the coach’s name and ACodes in ascending order of ACode from
the table COACH
(iv) To display the content of the GAMES table whose ScheduleDate earliar than
01/01/2004 in ascending order of ParticipantNum.
15. (b) Consider the following tables ACTIVITY and COACH and answer the questions:
SP3
16. (b) Consider the following tables Stationary and Consumer. Write SQL commands for
the statement (i) to (iv). 2013 S. P. 1
17. (b) Consider the following tables EMPLOYEES and EMPSALARY. Write SQL
commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).
2013 S.P. 2
(i) To display Firstname, Lastname, address and city of all employees leaving in Paris from
the table EMPLOYEES.
(ii) To display the content of EMPLOYEES table in descending order of Firstname.
(iii) To display the Firstname , Lastname, and total salary of all Managers from the
tablesEMPLOYEES and EMPSALARY, where total salary is calculated as SALARY +
BENEFITS
(iv) To display the maximum salary among Managers and Clerks from the table
EMPSALARY.
18. (b)Consider the following table Organisation and Grossincome and answer (I) and (II)
part of the question: 2013 S.P. 3
(I) Write SQL commands for the following statements:
(i) To display the details of all MEMBERS OF ORGANISATION in descending order of
DOJ.
(ii) To display NAME and POST of those MEMBERS whose SGRADE is either D002 or
D003.
(iii) To display the content of all the ORGANISATION table, whose DOJ is in between 09-
Feb-2006 and 08-Aug-2009.
(iv) To add a new row with the following 2007, ‘RUDRA’, ‘SALES INCHARGE’,
‘D002’,’26-Sep-2011’, ’26-Sept-1983’
19. (b)Consider the following tables SCHOOL and ADMIN. Write SQL commands for the
statements (i) to (iv) and give outputs for SQL queries (v) to (viii).
2013 S.P. 4
(i) To display TEACHERNAME, PERIODS of all teachers whose periods less than 25.
(ii) To display TEACHERNAME, CODE and DESIGNATION from tables SCHOOL and
ADMIN whose gender is male.
(iii) To display number of teachers in each subject wise.
(iv) To display CODE, TEACHERNAME and SUBJECT of all teachers who have joined the
school after 01/01/1999.
Consider the following table named EXAM with details of marks. Write command of MySQL for (i)
to (iv) and output for (v) to (vii).
Table EXAM
Ano sName Percentage section Stream
R001
R002
R003
R004
R005
(i) To display all information of the students of humanities in descending order of
percentage.
(ii) To display Adno, Name, Percentage and Stream of those students whose name is less
than 6 characters long.
adno char(5),
SName Varchar(20),
Percentage float(10,2),
section varchar(5),
Stream varchar(20)
);