0% found this document useful (0 votes)
35 views1 page

SQL Worksheet

Uploaded by

LAWANIYA SHARMA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views1 page

SQL Worksheet

Uploaded by

LAWANIYA SHARMA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

SQL WORKSHEET

CLASS XII -CS


SQL TABLES : ITEMS AND TRADERS
Table: TRADERS
TCODE TNAME CITY
T01 ELECTRONIC SALES MUMBAI
T02 BUSY STORE CORP DELHI
T03 DISP HOUSE INC CHENNAI
Table: ITEMS
CODE INAME QTY PRICE COMPANY TCODE
1001 DIGITAL PAD 12i 120 11000 DIGICLICK T01
1002 LED SCREEN 40 70 38000 SANTORA T02
1003 CAR GPS SYSTEM 50 21500 GEOKBOW T01
1004 DIGITAL CAMERA 160 8000 DIGICLICK T02
12X
1005 PEN DRIVE 32 GB 600 1200 STOREHOME T03

1. Create tables Items and traders where TCODE is foreign key.


2. To display the details of all the items in the ascending order of the item
names (i.e. INAME).
3. To display the item name and price of all those items, whose price is in the
range of 10000 and 22000 (both values inclusive).
4. To display the names of traders in descending order, who are either from
DELHI or MUMBAI.
5. To display the names of the, Trader, company and the names of the items
where company name starts with S.
6. Display the average price of items of each company
7. Increase the price of item by 5% if the QTY is more than 100
8. Add a column contact_no in the traders table
9. Change the company name ‘GEOKBOW’ to ‘SANTORA’
10. Remove the record of store home from the item table.
11. Remove the column city from traders table
12. Display all the details of tradsers along with Qty .
13. Write the output of following commands:
a. Select company,min(qty) from Items group by company;
b. Select count(*) from Items where price >=20000 order by price;
c. Select tname,qty, company from trader,items where price >8000 and
tradet.tcode=items.tcode;
d. Select avg(qty) from items where tcode in(‘t001’,’t003’)

You might also like