SSCE PRACTICAL EXAMINATION (2025 - 2026)
COMPUTER SCIENCE - NEW (083)
SQL
1. DBMS – SQL queries
Table : WORKER
WNO NAME DOJ DOB GENDER DCODE
1001 Sethuram 2013-09-02 1991-09-01 MALE D01
1002 Anil 2012-12-11 1990-12-15 FEMALE D02
1003 Shivaram 2014-01-17 1987-09-04 MALE D01
1007 Bala 2012-12-09 1984-10-19 MALE D03
1004 Laura 2013-11-18 1987-03-31 FEMALE D04
Write the Commands for the following and execute.
a) To count and display MALE workers who have joined after ‘1986-01-01’.
ANS: SELECT COUNT(*) FROM WORKER WHERE DOJ > ’1986-01-01’ AND GENDER
= MALE;
b) To display the names of workers having exactly four letters.
ANS: SELECT NAME FROM WORKER WHERE NAME LIKE ‘____’;
c) To display the number of distinct gender
ANS: SELECT count(DISTINCT( GENDER)) FROM WORKER;
Predict the output for the following SQL commands.
d) select count(*),DCODE from WORKER group by DCODE having
count(*) >1;
count(*) DCODE
2 D01
e) select max(DOJ),Min(DOB) from WORKER;
max(DOJ) Min(DOB)
2014-01-17 1984-10-19
2. DBMS – SQL queries
Table : ADMIN
Code Gender Designation
1001 Male Vice principal
1009 Female Coordinator
1203 Female Coordinator
1045 Male Hod
1123 Male Senior teacher
1167 Male Senior teacher
1215 Male Hod
Table: School
Code TeacherName Subject DOJ Periods Experience
1001 Ravi Shankar English 12/3/2000 24 10
1009 Priya Rai Physics 03/09/1998 26 12
1203 Lisa Anand English 09/04/2000 27 5
1045 Yashraj Maths 24/08/2000 24 15
1123 Ganan Physics 16/07/1999 28 3
1167 Harish B Chemistry 19/10/1999 27 5
1215 Umesh Physics 11/05/1998 22 16
Write the Commands for the following and execute.
a) To display DESIGNATION without duplicate entries from the table ADMIN.
ANS: SELECT DISTINCT(DESIGNATION) FROM ADMIN;
b) To display TEACHERNAME, CODE and corresponding DESIGNATION from tables SCHOOL and ADMIN of Male
teachers.
ANS: SELECT TEACHERNAME,CODE,DESIGNATION from SCHOOL,ADMIN WHERE
[Link]=[Link] AND GENDER=’MALE’;
c) To add a column as age to the table admin
ANS: ALTER TABLE ADMIN ADD AGE INT;
Predict the output for the following SQL commands.
d) SELECT TEACHERNAME FROM SCHOOL WHERE EXPERIENCE >12 ORDER BY
TEACHER;
TEACHERNAME
Umesh
Yashraj
e) SELECT COUNT (*), GENDER FROM ADMIN GROUP BY GENDER;
COUNT(*) GENDER
5 MALE
2 FEMALE
3. DBMS – SQL queries
RollNo Name Age Department DateOfAdm Fee Sex
1 Pankaj 24 Computer 1997-01-10 120 M
2 Shalini 21 History 1998-01-24 200 F
3 Sanjay 22 Hindi 1996-12-12 300 M
4 Sudha 25 Hindi 1999-07-01 400 F
5 Rakesh 22 History 1997-05-05 250 M
6 Shakeel 30 Computer 1998-06-27 300 M
7 Surya 34 Hindi 1997-02-25 300 M
8 Shika 23 Computer 1997-07-31 200 F
9 Zaheer 36 Computer 1997-03-12 230 M
TABLE : STUDENT
Write the Commands for the following and execute.
a) To show all the information about the student of history department.
ANS: SELECT * FROM STUDENT WHERE Department=’History’;
b) To list the names of all students with their Date of joining in ascending order.
ANS: SELECT Name, DateOfAdm FROM STUDENT ORDER BY DateOfAdm;
c) To list the name and department of all students whose name starts with ‘S’
ANS: SELECT Name, Department FROM STUDENT WHERE name LIKE ‘S%’;
Predict the output for the following SQL commands.
d) Select count(distinct( department)) from students;
count(distinct department)
e) Select * from students where sex=”F” and department=”hindi”;
RollNo Name Age Department DateOfAdm Fee Sex
4 Sudha 25 Hindi 1999-07-01 400 F
4. DBMS – SQL queries
TABLE : BOOKS
Book_ID Book_Name Authour_Name Publishers Price Type Qty
C001 Fast Cook Lata Kapoor EPB 355 Cookery 5
F001 The Tears William Hopkins First Publ 650 Fiction 20
T001 My First C++ Brain & Brooke EPB 350 Text 10
T002 C++ Brainer [Link] TDH 350 Text 15
F002 Thunderbolts Anna Roberts First Publ 750 Fiction 50
Book_ID Quantity_issued
T001 4
C001 5
F001 2
TABLE: ISSUED
Write the Commands for the following and execute.
a) To display the Book_ID,Book_Name and Quantity_issued for all books which have been issued.
(The query will require contents from both the tables)
ANS: SELECT B.Book_ID, B.Book_Name, I.Quantity_issued FROM BOOKS B, ISSUED I
WHERE I.Book_ID = B.Book_ID;
b) To increase the price of all books of EPB Publishers by 50.
ANS: UPDATE BOOKS SET Price=Price+50 WHERE Publishers = ‘EPB’;
c) To display the number of books in each publishers
ANS: SELECT count(*), Publishers FROM BOOKS GROUP BY Publishers;
Predict the output for the following SQL commands.
d) Select count(distinct( Publishers)) from Books where Publishers = “First Publ”;
count(distinct Publishers)
e) Select max(Price) from Books where Qty >=15;
max(Price)
750
5. DBMS – SQL queries
Table: CUSTOMER
CUSTID NAME PRICE QTY CID
101 ROHAN SHARMA 70,000 20 222
102 DEEPAK KUMAR 50,000 10 666
103 MOHAN KUMAR 30,000 5 111
104 SAHIL BANSAL 35,000 3 333
105 NEHA SONI 25,000 7 444
106 SONAL AGGARWAL 20,000 5 333
Table : COMPANY
CID NAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY MADRAS MOBILE
Write the Commands for the following and execute.
a) To display those company name which is in delhi.
ANS: SELECT NAME FROM COMPANY WHERE CITY=’DELHI’;
b) To delete the QTY column from the table customer
ANS: ALTER TABLE CUSTOMER DROP QTY;
c) To increase the price by 3000;
ANS: UPDATE CUSTOMER SET PRICE=PRICE+3000;
Predict the output for the following SQL commands.
d) SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r;
AVG(QTY)
7.5
e) SELECT PRODUCTNAME,CITY, PRICE
FROM COMPANY, CUSTOMER WHERE
COMPANY. CID=[Link] AND PRODUCTNAME=”MOBILE”;
productname city price
mobile mumbai 70000
mobile mumbai 25000
6. DBMS – SQL queries
Table: STUDENT
Write the Commands for the following and execute.
a) To display data in ascending / descending order by name
ANS: select * from student order by name;
b) To remove any one student record from the student table.
ANS: delete from student where sno=2;
c) To display the number of students in each dept.
ANS: select count(*),dept from student group by dept;
Predict the output for the following SQL commands.
d) Select COUNT(distinct dept) from student.
COUNT(distinct dept)
e) Select MAX(age) from student where Gender=’F’.
MAX(age)
21
7. DBMS – SQL queries
To write SQL commands for the following on the basis of given relations.
Table: Stationary Table : Consumer
a) To display the details of those consumers whose Address is Delhi.
ANS: SELECT * FROM CONSUMER WHERE ADDRESS=’DELHI’;
b) To display the details of Stationary whose Price is in the range of 4 to 22.
ANS: SELECT * FROM STATIONARY WHERE PRICE BETWEEN 4 AND 22;
c) To display the C_name, Address from Table consumer, and Company and price from
table stationary ,with their corresponding matching P_ID.
ANS: SELECT C_NAME,ADDRESS,COMPANY,PRICE FROM
STATIONARY,CONSUMER WHERE [Link]=[Link];
d) Select Distinct Address from Consumer.
Distinct Address
DELHI
CHENNAI
BANGALORE
MUMBAI
e) Select company, MAX(price),MIN(price),COUNT(*) from stationaryGROUPBYcompany
COMPANY MAX(PRICE) MIN(PRICE) COUNT(*)
CAMLIN 30 20 2
DOMS 5 5 2