Question
Write SQL queries for (a) to (d) and find outputs for SQL queries (e) to (i), which are based on the tables.

TABLE: WATCHES

Watchid Watch_name Price Type Qty_store
W001 High time 10000 Unisex 100
W002 Life time 15000 Ladies 150
W003 Wave 20000 Gents 200
W004 High fashion 7000 Unisex 250
W005 Golden time 25000 Gents 100

TABLE: SALE

Watchid Qty_Sold Quarter
W001 10 1
W003 5 1
W002 20 2
W003 10 2
W001 15 3
W002 20 3
W005 10 3
W003 15 4

(a) To display all the details of those watches whose name ends with ‘time’

(b) To display watch’s name andprice of those watches which have price range between 5000-15000

(c) To display total quantity in store of unisex type watches

(d) To display watch name and their quantity sold in first quarter

(e) Select max(price),min(qty_store) from watches;

(f) Select quarter, sum(qty_sold) from sale group by quarter;

(g) Select watch_name,price,type from watches w, sale s where w.watchid=s.watchid;

(h) Select watch_name, qty_store, sum(qty_sold),qty_store

(i) W.watch=s.watchid group by s.watchid;

Answer

(a) select * from watches where watch_name like ‘%TIME’;

(b) select Watch_name, Price from Watches where price between 5000 and 15000;

OR

Select Watch_name, Price from Watches where Price>=5000 and Price<=15000;

(c) Select sum(Price) from Watches where Type=’UNISEX’;

(d) Select Watch_name, Qty_sold from Watches, Sale where Watches. Watchid = Sale. Watchid and Quarter = 1;

(e)

(f)

quarter sum(qty_sold)
1 15
2 30
3 45
4 15

watch_name price type
HighFashion 7000 Unisex

watch_name qty_store qty_sold Stock
HighTime 100 25 75
LifeTime 150 40 110
Wave 200 30 170
GoldenTime 100 10 900

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free