Practical File Work – TERM 1 (2025 - 26)
Important Instructions:
1. Notebook Format:
o Use a practical file with one side blank and one side ruled (lined) on each open page.
o The ruled page will be used for writing the question and SQL query.
o The blank (white) page will be used for the output.
2. Pen and Writing Instructions:
o Use a Black Pen to write the Question.
o Use a Blue Pen to write the SQL Query.
o Use a Pencil to write the Output on the blank (white) page.
3. Execution First:
o First execute all SQL commands in the system/laptop.
o After confirming that your output is correct, then write the complete solution in your
practical file.
Q1: Write the output produced by the following SQL commands:
a) SELECT POW(2, 3);
b) SELECT ROUND(123.2345, 2), ROUND(342.9234, -1);
c) SELECT LENGTH("Informatics Practices");
d) SELECT YEAR("1979/11/26"), MONTH("1979/11/26"), DAY("1979/11/26"),
MONTHNAME("1979/11/26");
e) SELECT LEFT("INDIA", 3), RIGHT("Computer Science", 4);
f) SELECT MID("Informatics", 3, 4), SUBSTR("Practices", 3);
Q2: 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 Tooth Paste 54 Colgate
P03 Soap 25 Lux
P04 Tooth Paste 65 Pepsodant
P05 Soap 38 Dove
P06 Shampoo 245 Dove
a) Write SQL queries for the following:
i. Create the table Product with appropriate data types and constraints.
ii. Identify the Primary Key in Product.
iii. List the PCode, PName, and UPrice in descending order of product name. If PName
is the same, then display data in ascending order of price.
iv. Add a new column Discount to the table Product.
v. Update the Discount as 10% of UPrice for all products where UPrice > 100, otherwise
set discount to 0.
vi. Increase the price by 12% for all products manufactured by Dove.
vii. Display the total number of products manufactured by each manufacturer.
b) Write the output produced by the following queries:
i. SELECT PName, AVG(UPrice) FROM Product GROUP BY PName;
ii. SELECT DISTINCT Manufacturer FROM Product;
iii. SELECT COUNT(DISTINCT PName) FROM Product;
iv. SELECT PName, MAX(UPrice), MIN(UPrice) FROM Product GROUP BY PName;
Q3: Using the CARSHOWROOM database given in the chapter, write the SQL queries for the
following:
a) Add a new column Discount in the INVENTORY table.
b) Set appropriate discount values for all cars keeping in mind the following:
(i) No discount is available on the LXI model.
(ii) VXI model gives a 10% discount.
(iii) A 12% discount is given on cars other than LXI model and VXI model.
c) Display the name of the costliest car with fuel type “Petrol”.
d) Calculate the average discount and total discount available on Car4.
e) List the total number of cars having no discount.
Q4: Consider the following tables — Student and Stream — in the Streams_of_Students database.
The primary key of the Stream table is StCode, which is the foreign key in the Student
table. The primary key of the Student table is AdmNo.
Table - Student
AdmNo Name StCode
211 Jay NULL
241 Aditya S03
290 Diksha S01
333 Jasqueen S02
356 Vedika S01
380 Ashpreet S03
Table - Stream
StCode Stream
S01 Science
S02 Commerce
S03 Humanities
Write SQL queries for the following:
a) Create the database Streams_Of_Students.
b) Create the table Student by choosing appropriate data types based on the data given
in the table.
c) Identify the Primary keys from tables Student and Stream. Also, identify the foreign
key from the table Stream.
d) Jay has now changed his stream to Humanities. Write an appropriate SQL query to
reflect this change.
e) Display the names of students whose names end with the character ‘a’. Also, arrange
the students in alphabetical order.
f) Display the names of students enrolled in Science and Humanities stream, ordered
by student name in alphabetical order, then by admission number in ascending order
(for duplicating names).
g) List the number of students in each stream having more than 1 student.
h) Display the names of students enrolled in different streams, where students are
arranged in descending order of admission number.
i) Show the Cartesian product on the Student and Stream table. Also mention the
degree and cardinality produced after applying the Cartesian product.
j) Add a new column ‘TeacherIncharge” in the Stream table. Insert appropriate data in
each row.
k) List the names of teachers and students.
l) If Cartesian product is again applied on Student and Stream tables, what will be the
degree and cardinality of this modified table?