Set 1.
ORDERED
ORDER_ITEM CUSTOMER
ITEMNO UNITPRICE
I237 20
I192 72
I010 70
I700 50
I528 55
On the basis of this relational schema write the following queries in Structured Query Language.
(a) Retrieve the number and date of orders placed by customers residing at Atlanta city.
(C.City='Atlanta'));
OUTPUT:
ORDERNO ORDERDATE
F500 12-01-2017
F600 10-01-2017
(b) Retrieve the number and unit price of items for which an order of quantity greater than 50 is
placed.
WHERE((O.ItemNo=I.ItemNo)and
OUTPUT:
ITEMNO UNITPRICE
I237 20
(c) Retrieve the order number, date and Item number for the order of Items having a unit price
greater than 20.
(T.ItemNo=I.ItemNo) and
(d) Retrieve details of customers who have placed an order for the item number IO1O.
(O.OrderNo = T.OrderNo)and
(T.ItemNo = 'I010'));
OUTPUT:
(e) Retrieve the number and unit price of items for which an order is placed by the customer number
COO1.
(SELECT OrderNo
C.CustNo = 'C001'));
OUTPUT:
ITEMNO UNITPRICE
I010 70
Set 2.
On the basis of this relational schema write the following queries in Structured Query Language.
(a) Find the names of all employees who work for First Bank Corporation.
(b) Find the names, street addresses and cities of residence of all employees who work for First Bank
Corporation and earn more than 100,000 per annum.
(c) Find the names of all employees in this database who live in the same city as the company for
which they work,
(e) Find the average, maximum and minimum salary for each con1pany.
Set 3.
On the basis of this relational schema, write the following queries in Structured Query Language.
(a) Retrieve the ID and name of all the branches located in ‘Seattle’ city.
(b) Retrieve the ID, type and amount of all the transactions of withdrawal type.
(c) List the number and type of all accounts opened in the branch having ID B010.
(d) List the number and name of account holders withdrawing an amount greater than 10,000 on
31st March, 2007.
(e) List the number and name of account holders having savings account in the city
Los Angeles.
(f) Calculate the average balance of accounts present in the AX International Bank in New York.
(g) Calculate the maximum and minimum balance of accounts in each city.