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

Wa0002.

The document outlines practical work for Class XII Computer Science, focusing on SQL queries related to a grocery shop's product table and a sports database. It includes tasks such as creating tables, inserting data, and executing various SQL commands to manipulate and retrieve information. Additionally, it covers operations on student and project databases, as well as queries related to employee and book tables.

Uploaded by

Aditya Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views5 pages

Wa0002.

The document outlines practical work for Class XII Computer Science, focusing on SQL queries related to a grocery shop's product table and a sports database. It includes tasks such as creating tables, inserting data, and executing various SQL commands to manipulate and retrieve information. Additionally, it covers operations on student and project databases, as well as queries related to employee and book tables.

Uploaded by

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

Class XII Computer Science(083)

Practical Work(2025-26)

1. Consider the following table named “Product”, showing details of products being sold in a grocery
shop.
PCode PName UPrice Manufacturer
P01 Washing Powder 120 Surf
P02 Toothpaste 54 Colgate
P03 Soap 25 Lux
P04 Toothpaste 65 Pepsodent
P05 Soap 38 Dove
P06 Shampoo 245 Dove
Write SQL queries for the following:
a) Create the table Product with appropriate data types and constraints.
b) Identify the primary key in Product.
c) List the Product Code, Product name and price in descending order of their product name.
If PName is the same, then display the data in ascending order of price.
d) Add a new column Discount to the table Product.
e) Calculate the value of the discount in the table Product as 10 per cent of the UPrice for all those
products where the UPrice is more than 100, otherwise the discount will be 0.
f) Increase the price by 12 per cent for all the products manufactured by Dove.
g) Display the total number of products manufactured by each manufacturer.

2. Write the output(s) produced by executing the following queries on the basis of the information given
above in the table Product:
a) SELECT PName, avg(UPrice) FROM Product GROUP BY Pname;
b) SELECT DISTINCT Manufacturer FROM Product;
c) SELECT COUNT (DISTINCT PName) FROM Product;
d) SELECT PName, MAX(UPrice), MIN(UPrice) FROM Product GROUP BY PName;

3.Suppose your school management has decided to conduct cricket matches between students of Class
XI and Class XII. Students of each class are asked to join any one of the four teams – Team Titan, Team
Rockers, Team Magnet and Team Hurricane. During summer vacations, various matches will be
conducted between these teams. Help your sports teacher to do the following:

a) Create a database “Sports”.


b) Create a table “TEAM” with following considerations:
i) It should have a column TeamID for storing an integer value between 1 to 9, which refers
to unique identification of a team.
ii) Each TeamID should have its associated name (TeamName), which should be a string of
length not less than 10 characters.
c) Using table level constraint, make TeamID as the primary key.
d) Show the structure of the table TEAM using a SQL statement.
e) As per the preferences of the students four teams were formed as given below. Insert these four rows
inTEAM table:
Row 1: (1, Team Titan)
Row 2: (2, Team Rockers)
Row 3: (3, Team Magnet)
Row 3: (4, Team Hurricane)
f) Show the contents of the table TEAM using a DML statement.
g) Now create another table MATCH_DETAILS and insert data as shown below. Choose appropriate data
types and constraints for each attribute.

4. Using the sports database containing two relations (TEAM, MATCH_DETAILS) and write the queries for
the following:

a) Display the MatchID of all those matches where both the teams have scored more than 70.
b) Display the MatchID of all those matches where FirstTeam has scored less than 70 but
SecondTeam has scored more than 70.
c) Display the MatchID and date of matches played by Team 1 and won by it.
d) Display the MatchID of matches played by Team 2 and not won by it.
e) Change the name of the relation TEAM to T_DATA. Also change the attributes TeamID and
TeamName to T_ID and T_NAME respectively.

5.

For the above given database STUDENT-PROJECT, answer the following:


a) Name primary key of each table.
b) Find foreign key(s) in table PROJECT-ASSIGNED.
c) Is there any alternate key in table STUDENT? Give justification for your answer.
d) Can a user assign duplicate value to the field RollNo of STUDENT table? Jusify.

6 For the above given database STUDENT-PROJECT, can we perform the following operations?

a) Insert a student record with missing roll number value.


b) Insert a student record with missing registration number value.
c) Insert a project detail without submission-date.
d) Insert a record with registration ID IP-101-19 and ProjectNo 206 in table PROJECT-ASSIGNED.
7.Write the output for SQL queries (i) to (iii), which are based on the table:Employees

Empid Firstnam Lastname Designation City Salary


e
010 Ravi Kumar Manager GZB 75000
105 Harry Waltor Manager GZB 65000
152 Sam Tones Director Paris 80000
215 Sarah Ackerman Manager Upton 75000
244 Manila Sengupta Clerk New Delhi 50000
300 Robert Samuel Clerk Washington 45000
335 Ritu Tondon Clerk GZB 40000
400 Rachel Lee Salesman New York 32000
441 Peter Thompson Salesman Paris 28000

a) Select Designation , count(*) from Employees Group by Designation Having count(*)>=3;


b) Select Max (salary), Min(Salary) from Employees Where City in (‘GZB’, ‘Paris’);
c) Select Firstname, Lastname from Employees where Firstname like ‘R%’;
8. Write output for queries (i) to (iii), which are based on the table: (Relation name : BOOKS)

Book_id Book_name Author_name Publisher Price Qty


C0001 Fast Cook Lata Kapoor EPB 355 5
F0001 The Tears William hopkin NIL 650 20
T0001 My First Py Brain& Brooke EPB 350 10
T0002 Brain works A.W. Rossaine TDH 450 15
F0002 Thunderbolts Anna Roberts NIL 750 5
i) Select Count(Publisher) from Books;
ii) Select Max(Price) from books where qty >=15;
iii) Select count(distinct publishers) from books where Price>=400;
9. Write SQL commands for (a) to (e) on the basis of table INTERIORS and NEWONES.
INTERIORS
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Red rose Double bed 23/02/02 32000 15
2 Soft touch Baby cot 20/01/02 9000 10
3 Jerry’s home Baby cot 19/02/02 8500 10
4 Rough wood Office Table 01/01/02 20000 20
5 Comfort zone Double bed 12/01/02 15000 20
6 Jerry look Baby cot 24/02/02 7000 19
7 Lion king Office Table 20/02/02 16000 20
8 Royal tiger Sofa 22/02/02 30000 25
9 Park sitting Sofa 13/12/01 9000 15
NEWONES
RNO ITEMNAME TY DATEOFSTOCKS PRICE DISCOUNT
11 White wood Double 23/03/03 20000 20
bed
12 James 007 Sofa 20/02/03 15000 15
13 Tom look Baby cot 21/02/13 7000 10
(a) To show all information about the sofas from the INTERIORS table.
(b) To list the ITEMNAME which are priced at more than 10,000 from the INTERIORS table.
(c) To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is before 22/01/02 from the
INTERIERS table in the descending order of ITEMNAME.
(d ) To display ITEMNAME and DATEOFSTOCK of those items, in which the discount percentage is more
than 15 from INTERIORS table.
( e )To count the number of items, whose type is “Double Bed” from INTERIOR table.

10. Write SQL commands for (a) to (e) on the basis of table FURNITURE AND ARRIVAL.
FURNITURE

NO. ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT


1 White lotus Double Bed 23/02/02 30000 25
2 Pink feather Baby cot 20//01/02 7000 20
3 Dolphin Baby cot 19/02/02 9500 20
4 Decent Office Table 01/01/02 25000 30
5 Comfort Zone Double Bed 12/01/02 25000 25
6 Donald Baby cot 24/02/02 6500 15
7 Royal Finish Office Table 20/02/02 18000 30
8 Royal tiger Sofa 22/02/02 31000 30
9 Econo sitting Sofa 13/12/01 9500 25
10 Eating Dining Table 19/02/02 11500 25
paradise
ARRIVAL

NO. ITEM NAME TYPE DATEOFSTOCk PRICE DISCOUNT


11 WoodComfort Double Bed 23/03/03 2500 25
12 Old Fox Sofa 20/02/03 1700 20
13 Micky Baby cot 21/02/02 7500 15

(a) To show all information about the baby cots from the FURNITURE table.
(b) To list the ITEMNAME which are priced at more than 15000 from the FURNITURE table.
(c) To list ITEMNAME AND TYPE of those items, in which DATEOFSTOCK is before 22/01/02from the
FURNITURE table in descending order of ITEMNAME.
(d) To display ITEMNAME and DATEOFSTOCK of those items, in which the DISCOUNT percentage is
more than 25 from FURNITURE table.
(e) To insert a new row in the ARRIVALS table with the following data:14, “Velvet touch”, Double bed”,
{25/03/03}, 25000, 30.

11. Write a function(s) to show working of Create , Insert , Update and Alter command.(Connectivity with
SQL ).Program is user defined.

You might also like