Page 198 - Informatics_Practices_Fliipbook_Class12
P. 198
16. Ms. Mohini is working in a school and stores the details of all students in a table SCHOOLDATA. [2022]
Table : Schooldata
Admno Name Class House PERCENT GENDER DOB
20150001 Aditya Das 10 Green 86 Male 2006-02-20
20140212 Harsh Sharma 11 Red 75 Male 2004-10-05
20090234 Swapnil Pant 10 Yellow 84 Female 2005-11-21
20130216 Soumen Rao 9 Red 91 Male 2006-04-10
20190227 Rahil Arora 10 Blue 70 Male 2005-05-14
20120200 Akasha Singh 11 Red 64 Female 2004-12-16
Write SQL statements from the above-given table to:
(i) To remove leading spaces from the column Name.
(ii) Display the names of students who were born on Sunday.
OR
Predict the output of the following SQL queries from the given table SCHOOLDATA
(i) SELECT MAX(Percent) FROM SCHOOLDATA;
(ii) SELECT LEFT(Gender,1), Name FROM SCHOOLDATA WHERE YEAR (Dob)=2005;
Ans. (i) SELECT LTRIM(name) FROM schooldata;
(ii) SELECT name FROM schooldata WHERE dayname(dob) = 'Sunday';
OR
(i) MAX(Percent)
91
(ii) LEFT(Gender,1) Name
F Swapnil
M Rahil Arora
17. Predict the output of the following SQL queries: [2022]
(i) SELECT TRIM(" ALL THE BEST ");
(ii) SELECT POWER(5,2);
(iii) SELECT UPPER (MID("start up india",10);
OR
Consider a table "MYPET" with the following data:
Table: Mypet
Pet_id Pet_Name Breed LifeSpan Price Discount
101 Rocky Labrador Retriever 12 16000 5
202 Duke German Shepherd 13 22000 10
303 Oliver Bulldog 10 18000 7
404 Cooper Yorkshire Terrier 16 20000 12
505 Oscar Shih Tzu NULL 25000 8
Write SQL queries for the following:
(i) Display the Breed of all the pets in uppercase.
(ii) Display the total price of all the pets.
(iii) Display the average life span of all the pets.
Ans. (i) ALL THE BEST
(ii) 25
(iii) INDIA
OR
184 Touchpad Informatics Practices-XII

