0% found this document useful (0 votes)
27 views5 pages

R1C2 Questions

The document contains a series of SQL command exercises based on various tables, including Vehicle, Travel, PRODUCT, CLIENT, LOANS, COMPANY, MODEL, STATIONERY, CONSUMER, STOCK, and DEALER. Each section provides specific tasks such as displaying, updating, and querying data from the tables. The exercises are designed for students to practice SQL commands and understand database management concepts.

Uploaded by

moammed
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)
27 views5 pages

R1C2 Questions

The document contains a series of SQL command exercises based on various tables, including Vehicle, Travel, PRODUCT, CLIENT, LOANS, COMPANY, MODEL, STATIONERY, CONSUMER, STOCK, and DEALER. Each section provides specific tasks such as displaying, updating, and querying data from the tables. The exercises are designed for students to practice SQL commands and understand database management concepts.

Uploaded by

moammed
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/ 5

1

ET-1

CLASS: XII COMPUTER SCIENCE (083) MARKS: 40


DATE:30.05.2024 TIME : 1.30mins
1. Based on the tables Vehicle, Travel given below, Write SQL commands for the
following questions: (5)
Table : Vehicle
CODE VTYPE Pre KM
101 Volvo bus 160
102 AC DELUXE BUS 150
103 ORDINARY BUS 90
104 CAR 20
105 SUV 40
Table : Travel
NO NAME TDATE KM CODE NOP
101 Jansi Kin 2015-11-13 200 101 32
103 Vedika Sahai 2016-04-21 100 103 45
105 Tarun Ram 2016-03-23 350 102 42
102 John Fen 2016-02-13 90 104 40
107 Ahmed Khan 2015-01-10 75 104 2
104 Raveena 2016-05-28 80 105 4
106 Kripal Anya 2016-02-06 200 101 25

i) To display NO, NAME,TDATE from the table TRAVEL in descending order of NO.
ii) To display the NAME of all the travellers from the table TRAVEL who are travelling by
vehicle with code 101 or 102.
iii) To display the NO and NAME of those travellers from the table TRAVEL who travelled
between ‘2015-04-01’ and ‘2015-12-31’
iv) To display the CODE, NAME, VTYPE from both the tables with distance travelled
(KM) is less than 90 km.
v) To display the NAME and amount to be paid for vehicle code as 105. Amount to be paid
is calculated as the product of KM and PERKM.

2. Based on the tables PRODUCT and CLIENT given below, Write SQL commands and
SHRIKARRA VIDHYA MANDHIR(CBSE) rE
Revision Test - 1 Concept - 2
1
Outputs for the following questions: (5)
Table : PRODUCT
P_ID ProductName Manufacture Price ExpiryDate
TP01 Talcum Powder LAK 40 2011-06-26
FW05 Face Wash ABC 45 2010-12-01
BS01 Bath Soap ABC 55 2010-09-10
SH06 Shampoo XYZ 120 2012-04-09
FW12 Face Wash XYZ 95 2010-08-15
Note: P_ID is the Primary Key
Table : CLIENT
C_ID ClientName City P_ID
1 Cosmetic Shop Delhi FW05
6 Total Health Mumbai BS01
12 Live Life Delhi SH06
15 Pretty One Delhi FW05
16 Dreams Bangaluru TP01
14 Expressions Delhi NULL
Note: P_ID is the Primary Key
P_ID is the Foreign Key referencing P_ID of client table.
i) Increase the price of all the products in Product table by 10%
ii) To display the ProductName, Manufacturer, ExpriyDate of all the products that
expired on or before ‘2010-12-31’
iii) To display C_ID, ClientName, City of all the clients(includes the ones that have
not purchased a product)and their corresponding ProductName sold.
iv) SELECT COUNT (DISTINCT Manufacturer) FROM Product;
v) SELECT C_ID, ClientName, City FROM Client WHERE City LIKE’M%’;

3. Based on the table LOANS given below, Write SQL commands for the following
questions: (6)
Table : LOANS
AccNo Cust_Name Loan_ Instalments Int_Rate Start_Date Interest
Amount
1 R.K.Gupta 300000 36 12.00 2009-07-19 1200
2 S.P.Sharma 500000 48 10.00 2008-03-22 1800
3 K.P.Jain 300000 36 NULL 2007-03-08 1600
4 M.P.Yadav 800000 60 10.00 2008-12-06 2250
5 S.P.Sinha 200000 36 12.50 2010-01-03 4500
6 P.Sharma 700000 60 12.50 2008-06-05 3500
7 K.S.Dhall 500000 48 NULL 2008-03-05 3800

i) Display the sum of all Loan amounts whose Interest rate is greater than 10.
ii) Display the maximum Interest from Loans table
iii) Display the count of all loan holders whose name ends with ‘Sharma’
iv) Display the count of all loan holders whose Interest rate Null.
v) Display the Interest-wise details of Loan Account Holders.

SHRIKARRA VIDHYA MANDHIR(CBSE) rE


Revision Test - 1 Concept - 2
1
vi) Display the Interest-wise details of Loan Account Holders with at least 10
installments remaining.

4. Based on the tables PRODUCT and CLIENT given below, Write SQL commands and
Outputs for the following questions: (6)
Table : PRODUCT
P_ID ProductName Manufacture Price
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120
FW12 Face Wash XYZ 95
Table : CLIENT
C_ID ClientName City P_ID
1 Cosmetic Shop Delhi FW05
6 Total Health Mumbai BS01
12 Live Life Delhi SH06
15 Pretty One Delhi FW12
16 Dreams Bangaluru TP01

i) To display the details of those Clients whose city is Delhi


ii) To display the details of Products whose price is in the range of 50 to 100 (both
values included)
iii) SELECT DISTINCT City FROM CLIENT;
iv) SELECT Manufacture,MAX(Price), MIN(Price),COUNT(*) FROM PRODUCT
GROUP BY Manufacturer;
v) SELECT Product Name, Price*4 FROM PRODUCT;
vi) To display the details of those products whose name ends with ‘wash’

5. Based on the tables COMPANY and MODEL given below, Write SQL commands and
Outputs for the following questions: (6)
Table : COMPANY
Comp_ID CompName CompHO ContactPerson
1 Titan Okhla C.B.Ajit
2 Ajanta Najafgarh R.Mehta
3 Maxima Shahdara B.Kohli
4 Seiko Okhla R.Chadha
5 Ricoh Shahdara J.Kishore
Note: Comp_ID is the Primary Key

Table : MODEL
SHRIKARRA VIDHYA MANDHIR(CBSE) rE
Revision Test - 1 Concept - 2
1
Model_ID Comp_ID Cost DateOfManufacturer
T020 1 2000 2010-05-12
M032 4 7000 2009-04-15
M059 2 800 200-09-23
A167 3 1200 2011-01-12
T024 1 1300 2009-10-14
Note: Model_ID is the Primary Key
Comp_ID is the Foreign Key referencing Comp_ID of Company Table.

i) To display details of all models in the Model table in ascending order of


DateOfManufacturer
ii) To display details of those models manufactured in 2011 and whose Cost is
below 2000.
iii) To display the Model_ID,Comp_ID, Cost from the table Model, CompName and
ContactPerson from Company table, with their corresponding Comp_ID.
iv) To decrease the cost of all the models in Model table by 15%.
v) SELECT COUNT(DISTINCT CompHO) FROM Company;
vi) SELECT CompName, ‘Mr.’ , ContactPerson FROM Company WHERE
CompName LIKE’%a’;

6. Based on the tables STATIONERY and CONSUMER given below, Write SQL
commands and Outputs for the following questions: (6)
Table : STATIONERY
S_ID Stationery_Name Company Price StockDate
DP01 Dot Pen ABC 10 2011-03-31
PL02 Pencil XYZ 6 2010-01-01
ER05 Eraser XYZ 7 2010-02-14
PL01 Pencil CAM 5 2009-01-09
GP02 Gel Pen ABC 15 2009-03-19
Note: S_ID is the Primary Key
Table : CONSUMER
C_ID ConsumerName Address P_ID
01 Good Learner Delhi PL01
06 Write Well Mumbai GP02
12 Topper Delhi DP01
15 Write & Draw Delhi PL02
16 Motivation Bengaluru PL01
Note: C_ID is the Primary Key
P_ID is the Foreign Key referencing S_ID of Stationery Table.
i) To display details of all the Stationery Items in the Stationery table in descending order
of StockDate.
ii) To display details of that Stationery item whose Company is XYZ and price is below 10.
iii) To display ConsumerName, Address from the table Consumer and Company and Price
from Stationery table, with their corresponding S_ID.
iv) To increase the price of all the stationery items in Stationery table by Rs.2.
v) SELECT StationeryName, Price*3 FROM Stationery WHERE Company =’CAM’;
SHRIKARRA VIDHYA MANDHIR(CBSE) rE
Revision Test - 1 Concept - 2
1
vi) SELECT COUNT(DISTINCT ADDRESS) FROM CONSUMER;

7. Based on the tables STOCK and DEALER given below, Write SQL
commands and Outputs for the following questions: (6)
Table : STOCK
ItemNo Item Dcode Qty UnitPrice StockDate
5005 Ball Pen 0.5 102 100 16 2011-03-31
5003 Ball Pen 0.25 102 150 20 2010-01-01
5002 Gel Pen Premium 101 125 14 2010-02-14
5006 Gel Pen Classic 101 200 22 2009-01-09
5001 Eraser Small 102 210 5 2009-03-19
5004 Eraser Big 102 60 10 2010-12-12
5009 Sharpener Classic 103 160 8 2010-01-23
Note : ItemNo is the Primary Key
Dcode is the Foreign Key referencing Dcode of Dealer Table.

Table : DEALER
Dcode DName
101 Reliable Stationers
103 Class Plastics
104 Fair Deals
102 Clear Deals
Note : Dcode is the Primary Key

i) To display details of all the items in the Stock table in ascending order of StockDate.
ii) To display details of those Items in Stock table whose Dealer Code(Dcode) is 102 or quantity in
Stock(Qty) is more than 100
iii) To insert a record in the Stock table with the values:
(5010,’Pencil HB’, 102,500,10,’2010-01-26’)
iv) To display Dcode, Dname, from Dealer table and Item , UnitPrice from Stock table of all the
Dealers (including the dealer details that have not sold any item)
v) SELECT COUNT (DISTINCT DCode) FROM Stock;

vi) SELECT Qty*UnitPrice FROM Stock WHERE ItemNo=5006;

SHRIKARRA VIDHYA MANDHIR(CBSE) rE


Revision Test - 1 Concept - 2

You might also like