COMPUTER SCIENCE
CLASS 12TH
ASSIGNMENT -10
TOPIC - SQL
Customers
Cnum Cname city Rating Snum
Salespeople
Snum Sname city Comm
Orders
Onum Amt odate cnum snum bal
Q 1 Print all records from salespeople
Q 2 Print customer no. and name from customers
Q 3 Print salesman’s number & amt from orders
Q 4 How many salesman have got orders?
Q 5 Print all records with rating>300.
Q6 Print all records where city = London.
Q 7 Print all records with city = London and rating not equal to 200
Q 8 Select all records whose either city is not London or rating is not greater than 200.
Q 9 Where either city = London and rating>200 or city = rome and rating <100.
Q 10 Where city is either London or rome.
Q 11 Where Snum is 1001 or 1007, 1004.
Q 12 Where Cnum is between .10 and .12
Q 13 Where Q12 but exclusive .1 & .12
Q 14 Where Cname starts from P and end with G and lengthof 6 characters
Q 15 Where amount < 2000
1
Q 16 Count all records in costumer.
Q 17 Print maximum of amt + bal
Q 18 Find max amt of each salesperson in orders table.
Q 19 Find salesnumber and max amount of each salesnumber
Q 20 Find Snum, max (amt) of all Snum having max (amt) >3000
Q 21 Find sum & max amt of all Snum where date = 10/03/90
Q 22 Find Snum, max amt from orders for all Snum having Snum in (1002, 1007)
Q 23 Find total orders for each Snum
Q 24 Find all orders in descending order of date
Q 25 Find Snum, max amt of all Snum order by Snum
Q 26 List each order no followed by name of customers
Q 27 Give names of both the salesperson and customer for each order after the order no
Q 28 List all customer salesname, comm. Serviced by salespeople with comm. > 12%
Q 29 Calculate amount of salesperson comm. on each order by a customer with rating
greater than 100
Q 30 Delete all records with orders 1/1/99
Q 31 Create view that contains Cnum,snum and sname
.
Q 32 Change the city Rome to Italy.
Q33 Drop all tables.
Q34 Print total order of a customer with cnum=’255’
Q35 Print all orders that are more than 5000/-.