Final Copy of Class Xii Ip 2023-24-Worksheets
Final Copy of Class Xii Ip 2023-24-Worksheets
93 | P a g e
a. Write SQL query to print records in descending order of year
of admission.
b. Write SQL query to display house and number of students in
each house.
c. Write SQL query to display CLASS wise highest fees.
d. Predict output.
SELECT LENGTH(SNAME) FROM STUDENT;
TOTAL 25
94 | P a g e
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:1 (Answers) ::CLASS XII – IP
QN Answers M
1 d) Aggregate function 1
2 a)Now() 1
3 c)Instr() 1
4 GROUP BY clause is used in a SELECT statement in conjunction with 2
aggregate functions to group the result based on distinct values in a
column.
5 Function is a special type of predefined command set that performs 2
some operations and returns a single value.
Types of functions:
i) Single row functions
a) Mathematical/Numeric function
b) String functions
c) Date and Time Functions
ii) Multiple row functions
6 Order by clause is used to sort data in ascending or descending order 2
based on one or more column.
Group by clause can be used in a SELECT statement to collect data
across multiple records and group the result by one or more columns.
7 WHERE clause works in respect to the whole table but HAVING 2
clause works on Group only.
If where and having both are used then where can be executed
first.
Where is used to put a condition on individual row of a table
whereas HAVING is used to put a condition on an individual group
formatted by GROUP BY clause in select statement.
Having clause support aggregate functions
8 Aggregate function is a function where the values of multiple rows are 2
grouped together as input based on a certain criterion to form a single
value of more significant meaning.
Different aggregate functions are : SUM(), AVG(), MAX(), MIN(),
COUNT()
9 I. 8 3
II. NO OUTPUT
III. 0
15
10 i. SELECT * FROM STUDENT ORDER BY ADMYEAR DESC; 4
ii. SELECT HOUSE, COUNT(HOUSE) FROM STUDENT GROUP BY
HOUSE;
iii. SELECT CLASS, MAX(FEES) FROM STUDENT GROUP BY CLASS;
iv.
LENGTH(SNAME)
4
5
5
5
5
95 | P a g e
4
5
5
11 i. SELECT MID(‘INDIA SHINING’,7,7); 5
ii. SELECT INSTR(‘WELCOME WORLD’,’COME’);
iii. SELECT ROUND(23.78,1);
iv. SELECT MOD(100,9);
v. SELECT TRIM(USERID) FROM USERS;
TOTAL 25
96 | P a g e