Sie sind auf Seite 1von 21

Q.No.

5(a)
01. (a)What is a relation? What is the difference between a tuple and an attribute? 1998
02. (a) What is the need for normalization ? Define first, second and third normal forms.
1999 & 2000
03.(a) What are DDL and DML ? 2001
04. (a) What is relation ? Define the relational data model. 2002
05.(a) What do you understand by normalization ? What is First Normal Form? 2004
06.(a) What do you understand by the terms Primary Key and Degree of a relation in
relational database? 2005
07.(a) Differentiate between primary key and alternate key. 2007

09.(a) What do you understand by Candidate Keys in a table ? Give a suitable example
of Candidate keys from a table containing some meaningful data. 2009 & 2010
10.(a) What do you understand by Union & Cartesian Product operations in
relational algebra? 2011

11.(a) Giv a suitable example of a tabl with sample data and illustrate Primery and Alternate
Keys in it. 2012

12.(a) What do you understand by Degree and Cardinality of a table? S. P. 1 & 2 & 3
13. (a) What are DDL and DML Commands? Give one example of each. 2013 SP1&3
14. (a) What do you understand by the term alternate key and degree of a relation in a relational
database? 2013 SP 2

15. (a) What do you understand by the terms Alternate key and Foreign Key of a relation?
2013 SP 4
Q.No. 5 (B)

01. (b) Write SQL commands for (i) to (vii) and write the outputs for (vii) on the basis of
table HOSPITAL. 1998

(i) To select all the information of patients of cardiology department.


(ii) To list the names of female patients who are in ENT department.
(iii) To list names of all patients with their date of admission in ascending order.
(iv) To display patient's name, charges, age for only female patients.
(v) To count the number of patient with Age < 30.
(vi) To insert a new row in the HOSPITAL table with the following data:
11, "Aftab", 24, "Surgery". {25/02/98}, 300, "M"

(vii) Give the output of following SQL statements:


 SELECT COUNT(DISTINCT charges) FROM hospital
 SELECT MIN(age) FROM hospital WHERE sex = "F"
 SELECT SUM(charges) FROM hospital WHERE department = "ENT":
 SELECT AVG(charges) FROM hospital WHERE dateofadm<{12/02/98}
02. (b) Write SQL commands for (i) to (vii) and write the output for (vii) on the basis of
teacher relation given below: 1999

(i) To show all information about the teacher of History department.


(ii) To list the name of female teachers who are in Hindi department.
(iii) To list the names of all the teachers with their date of joining in ascending order.
(iv) To display Teachers Name, Salary, Age for male teachers only.
(v) To count the number of teachers with age > 23.
(vi) To insert a new row in the Teacher table with the following data.
9, “Raja”, 26, “Computer”, {13/05/95}, 2300, "M"

(vii) Give the output of the following SQL statements :


 SELECT COUNT (DISTINCT department) FROM teacher;
 SELECT MAX(age) FROM teacher WHERE sex = "F";
 SELECT AVG(salary) FROM teacher WHERE sex = "M";
 SELECT SUM(salary) FROM teacher WHERE dateofjoin<{12,07/96};

03. (b) Write SOL commands for (i) to (iv) and write the outputs for (v) on the basis of
table CLUB. 2000
(i) To show all information about the swimming coaches in the club.
(ii) To list name of all coaches with their date of appointment (DATEOFAPP) in
descending order.
(iii) To display a report, showing coachname, pay, age and bonus (15% of pay) for all the
coaches.
(iv) To insert a new row in the CLUB table with the following data :
11, "PRAKASH", 37, "SQUASH", {25/02/98}, 2500, "M"

(v) Give the output of following SQL statements :


 SELECT COUNT (DISTINCT sports) FROM club;
 SELECT MIN (age) FROM club WHERE sex = "F";
 (iii)SELECT AVG(pay) FROM club WHERE sports ="KARATE";
 SELECT SUM(pay) FROM club WHERE dateofapp > {31/01/98};
(vi) Assume that there is one more table COACHES in the database as shown below:

What will be the output of the following query :


SELECT sportsperson, coachname FROM club, coaches WHERE coach id = coach no;
04. (b) Write SQL commands for (i) to (vii) on the basis of the table STUDENT.
2001
(i) Display the names of the students who are getting grade 'C' in either Game or SupW.
(ii) Display the number of students getting grade 'A' in Cricket.
(iii) Display the different games offered in the school.
(iv) Display the SUPW taken up by the students, whose name starts with “A‟.
(v) Add a new column named 'Marks'.
(vi) Assign a value 200 for Marks for all those who are getting Grade 'B' or above in
Game.
(vii) Arrange the whole table in the alphabetical order of SUPW.

05.(b) Given the following Lab relations : 2002

Write SQL command for questions (i) to (vi).


(i) To select the Itemname purchased after 31/10/97.
(ii) To list the ItemName, which are within the Warranty period till present date.
(iii) To list the ItemName in ascending order of the date of purchase where quantity is
more than 3.
(iv) To display ItemName, CostPerltem and Quantity whose Warranty is over.
(v) To count the number of items whose cost is more than 10000.
(vi) To insert a new record in the Lab table with the following data :
I 8. "VCR", 10000. 2. 2 2 2000 . 1, 2

(vii) Give the output of the following SQL command :


 SELECT MIN (DISTINCT quantity) FROM lab;
 SELECT MIN(warranty) FROM lab WHERE quantity = 2;
 SELECT SUM(costperitem) FROM lab WHERE quantity >2;
 SELECT AVG(csostperitem) FROM lab WHERE dateofpurchase<{l/199};

06. (b) Given the following tables for a database LIBRARY.


2004

Write SQL command for questions (i) to (vi)


(i) To show Book name, Author name and Price of books of EPB publishers
(ii) To list the names of books of Fiction Type
(iii) To display the names and price of the books in descending order of their price
(iv) To increase the price of all books of First Publ. by 50
(v) To display the Book_Id, Book_Name and Quantity_Issued for all books which have
been issued. (The query will require contents from both the tables)
(vi) To insert a new row in the table Issued having the following data :
“F0002”, 4

(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.

(v) SELECT FIRSTNAME, SALARY FROM EMPLOYEES, EMPSALARY WHERE


DESIGNATION = ‘Salesman’ AND EMPLOYEES.EMPID = EMPSALARY.EMPID;
(vi) SELECT COUNT (DISTINCT DESIGNATION)FROM EMPSALARY;
(vii) SELECT DESIGNATION, SUM(SALARY) FROM EMPSALARY GROUP BY
DESIGNATION HAVING COUNT (*)>2;
(viii) SELECT SUM (BENEFITS) FROM EMPLOYEES WHERE DESIGNATION =
’Clerk’;
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

(i) To display the names of all Senders from Mumbai.


(ii) To display the RecID), SenderName, SenderAddress, RecName, RecAddress
for every Recipient.
(iii) To display Recipient details in ascending order of RecName.
(iv) To display number of Recipients from each city.

(v) SELECT DISTINCT SenderCity FROM Sender;


(vi) SELECT A. SenderName, B.RecName FROM Sender A, Recipient B WHERE A.
SenderlD = B.SenderlD AND B.RecCity = ‘Mumbai’;
(vii) SELECT RecName, RecAddress FROM Recipient WHERE RecCity NOT IN
(‘Mumbai’, ‘Kolkata’);
(viii) SELECT RecID, RecName FROM Recipient WHERE SenderID=’MU02'
ORSenderID=’ND50';
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

(i) To display GCODE and DESCRIPTION of each GARMENT in descending order of


GCODE

(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).

(v) SELECT SUM(PRICE) FROM GARMENT WHERE FCODE=‟F01‟;


(vi) SELECT DESCRIPTION, TYPE FROM GARMENT, FABRIC WHERE
GARMENT.FCODE =FABRIC.FCODE AND GARMENT.PRICE > = 1260;

(vii) SELECT MAX(FCODE) FROM FABRIC;

(viii) SELECT COUNT (DISTINCT PRICE) FROM GARMENT;

10.(b) Consider the following tables. Write SQL commands for the statements (i) to (iv)
and give outputs for SQL queries (v) to (viii). 2010

Write SQL commands for the following statements :

(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‟

Give the output of the following SQL queries :


(i) SELECT COUNT (PLEVEL), PLEVEL FROM WORKER GROUP
BY PLEVEL;
(ii) SELECT MAX(DOB), MIN(DOJ) FROM WORKER;
(iii) SELECT Name, Pay FROM WORKER W, PAYLEVEL P WHERE
W.PLEVEL = S.PLEVEL AND P.ECODE<13;
(iv) SELECT PLEVEL, PAY+ALLOWANCE FROM PAYLEVEL
WHERE PLEVEL = „P003‟;

12.(b) Consider the following tables CARDEN and CUSTOMER and answer the
questions. 2012
13. (b) Consider the following tables GAMES and PLAYER. Write SQL commands for
the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).
S.P. 1
(i) To display the name of all Games with their Gcodes
(ii) To display details of those games which are having PrizeMoney more than 7000.
(iii) To display the content of the GAMES table in ascending order of ScheduleDate.
(iv) To display sum of PrizeMoney for each of the Number of participation groupings (as
shown in column Number 2 or 4)

(v) SELECT COUNT(DISTINCT Number) FROM GAMES;


(vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;
(vii) SELECT SUM(PrizeMoney) FROM GAMES;
(viii) SELECT DISTINCT Gcode FROM PLAYER;

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.

(v) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY;


(vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY;
(vii) SELECT SUM(PrizeMoney) FROM ACTIVITY;
(viii) SELECT DISTINCT ParticipantNum FROM COACH;

15. (b) Consider the following tables ACTIVITY and COACH and answer the questions:
SP3

Write SQL commands for the flowing statements:


(i) To display the names of all activities with their Acodes in descending order.
(ii) To display sum of PrizeMoney for the Activities played in each of the Stadium
separately.
(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 Activity table whose ScheduleDate earlier than
01/01/2004 in ascending order of ParticipantsNum.

Give the output of the following SQL queries:


(i) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY;
(ii) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY;
(iii) SELECT Name,ActivityName FROM ACTIVITY A,COACH C
WHERE A.Acode=C.Acode AND A.ParticipantsNum=10;
(iv) SELECT DISTINCT Acode FROM COACH;

16. (b) Consider the following tables Stationary and Consumer. Write SQL commands for
the statement (i) to (iv). 2013 S. P. 1

(i) To display the details of those consumers whose Address is Delhi.


(ii) To display the details of Stationary whose Price is in the range of 8 to 15. (Both Value
included)
(iii) To display the ConsumerName, Address from Table Consumer, and Company and
Price from table Stationary, with their corresponding matching S_ID.
(iv) To increase the Price of all stationary by 2.

Write the output for SQL queries (v) to (viii):


(v) SELECT DISTINCT Address FROM Consumer;
(vi) SELECT Company, MAX(Price), MIN(Price), COUNT(*) from Stationary GROUP
BY
Company;
(vii) SELECT Consumer.ConsumerName, Stationary.StationaryName, Stationary.Price
FROM
Strionary, Consumer WHERE Consumer.S_ID=Stationary.S_ID;
(viii) Select StationaryName, Price*3 From Stationary;

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.

(v) SELECT FIRTNAME,SALARY FROM EMPLOYEES, EMPSALARY WHERE


DESIGNATION ='Salesman' AND EMPLOYEES.EMPID = EMPSALARY.EMPID;
(vi) SELECT COUNT(DISTINCT DESIGNATION) FROM EMPSALARY;
(vii) SELECT DESIGNATION,SUM(SALARY) FROM EMPSALARY GROUP BY
DESIGNATION HAVING COUNT(*)>2;
(viii) SELECT SUM(BENEFITS) FROM EMPLOYEES WHERE DESIGNATION =
'Clerk';

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’
(II) Give the output of the following SQL queries :
(i) SELECT COUNT(SGRADE), SGRADE FROM ORGANISATION GROUP BY
SGRADE;
(ii) SELECT MIN(DOB), MAX(DOJ) FROM ORGANISATION;
(iii) SELECT NAME,SALARY FROM ORGANISATION O, GROSSINCOME G
WHERE O.SGRADE=G.SGRADE AND O.ECODE<2003;
(iv) SELECT SGRADE, SALARY+HRA FROM GROSSINCOME WHERE
SGRADE=’D002’

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.

(v) SELECT MAX (EXPERIENCE), SUBJECT FROM SCHOOL GROUP BY


SUBJECT;
(vi) SELECT TEACHERNAME, GENDER FROM SCHOOL, ADMIN WHERE
DESIGNATION = ‘COORDINATOR’ AND SCHOOL.CODE=ADMIN.CODE;
(vii) SELECT DESIGNATION, COUNT (*) FROM ADMIN GROUP BY
DESIGNATION HAVING COUNT (*) <2;
(viii) SELECT COUNT (DISTINCT SUBJECT) FROM SCHOOL;

Das könnte Ihnen auch gefallen