SQL Practical-Question Paper
SQL Practical-Question Paper
ii) To display the customer name, city from table customer and item name and
price from table item with their corresponding matching I_ID.
iii) To display the customer name and price from Delhi customers who uses the
items whose price is more than 50000.
iv) List the items details whose price between 35000 and 50000.
v) SELECT Customername,manufacturer
From item, customer
Where item.I_ID = customer.I_ID;
vi) SELECT Itemname,price*100, customername
From item,customer
Where manufacturer= ‘ABC’ and item.I_ID = customer.I_ID;
Practical No 2: SENDER AND RECIPIENT TABLE AND QUERIES
i) Identify Primary Keys in the table and foreign key in recipient table given
above.
ii) To display the name of all senders along with the name of receiver from
Mumbai.
iv) To display recipient details along with the sender name in ascending order of
recname.
ii) Display names of all doctors who are in “MEDICINE” having more than 10
years’ experience and basic salary more than 10000.
iii) Display the average of all the Doctors working in “ENT” department using the
table DOCTOR and (SALARY.salary = BASIC + ALLOWANCES)
i) Identify primary keys in the table and the foreign key in the CLIENT table
given above.
ii) To display client name, city, from table CLIENT and Product name and Price
from table Product with their corresponding matching P_ID.
iv) To display the Client names and Product names who uses the product price
between 50 and 100.
Write the SQL command for (a) to (f) and write the output for the (g) on the basis of
table Teacher.
(b) To list the name of female teachers who are in math’s department.
(c) To list names of all the teachers along with their date of joining in
ascending order.
(d) To display teachers name, salary, age for male teacher only.
(a) List the name of those students who have obtained div1 = 1 sorted by
name
(b) Display the report listing name,, stipend, subject and amount of stipend
received in a year assuming that the stipend is paid every month.
(c) To count the number of student who are either PHYSICS or COMPUTER SC
graduate.
(e) Give the output of the following SQL statement based on table
GRADUATE
a. SELECT MIN(AVERAGE) FROM GRADUATE WHERE SUBJECT =
‘PHYSICS’;
b. SELECT SUM(STIPEND FROM GRADUATE WHERE DIV1 = 2;
c. SELECT AVG(STIPEND) FROM GRADUATE WHERE AVERAGE> =65;
d. SELECT COUNT(DISTINCE SUBJECT) FROM GRADUATE;
Practical No 2: Table- BANK
Write the SQL command for (a) to (F) and write the output for the (G) on the
basis of table BANK
(a) Display data for all the customers whose transaction is between 8 and 11.
(b) Display data for all customers sorted by their date of open.
(c) To count the number of customers with amount<30000.
(d) List minimum and maximum amount from the bank
(e) To list cname, bname, amount for all the clients whose amount is <20000.
(f) To display acc_no, cname, bname, total transactions in descending order of
amount.
(g) Give the output of the following sql commands
a. SELECT AVG(AMOUNT) FROM BANK WHERE AMOUNT < 23000.
Write the SQL command for (a) to (F) and write the output for the (G) on the
(a) To display the flight number of those flights which have frequency more than 4
times in a week;
(b) To display flightno, from city and to city of all those flight which are starting from
city blue islands or are having destination as blue islands.
(c) To display flightno and seating capacity of all those flights in which seating capacity
is more than 140.
(d) To display flightno, frequency and distance of all those flights, which are covering
distance more than 900 km.
( e) To display flightno all those flights which are weekly flights and having seating
capacity less than 180.
Write the SQL command for (a) TO (F) AND WRITE OUTPUT FOR (g)
(a) To display the title of all the books with price between 100 and 300.
(b) To display title and author of all the books having type prog and publisher BPB.
(c) To display the list of all the books with price more than 130 in ascending order of
qty.
(d) To display report with title. Misplacement charges(1.25 of price) for each book in
the table
(e) To display the publisher and the number of books of each publisher in the table
library
(f) To insert a new book in the table library with the following data
11,’Comp sci’,’Reeta’,’C++’,Rachana Sagar’1,225