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

Final Copy of Class Xii Ip 2023-24-Worksheets

This document contains a worksheet for Class XII on database queries using SQL, including questions and answers. It covers various SQL functions, the purpose of clauses like GROUP BY and HAVING, and provides SQL queries based on sample tables. The total marks for the worksheet are 25.

Uploaded by

domaininitial4
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 views4 pages

Final Copy of Class Xii Ip 2023-24-Worksheets

This document contains a worksheet for Class XII on database queries using SQL, including questions and answers. It covers various SQL functions, the purpose of clauses like GROUP BY and HAVING, and provides SQL queries based on sample tables. The total marks for the worksheet are 25.

Uploaded by

domaininitial4
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/ 4

NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL

WORKSHEET NO.:1 (Questions) ::CLASS XII – IP

Q.No. Question Marks


1 The count() function in MySql is an example of ______________. 1
a. Math function
b. Text function
c. Date Function
d. Aggregate Function
2 Which of the following SQL function will display the current time and 1
date.
a. now()
b. year()
c. day()
d. All of the above
3 The function is used in SQL to find one string into another. 1
a. substr()
b. mid()
c. instr()
d. left()
4 What is the purpose of GROUP BY Clause? 2
5 Define a function. Name different types of it. 2
6 Differentiate between Order By and Group By clause. 2
7 Differentiate between WHERE and HAVING clause. 2
8 What is aggregate function? Write its names. 2
9 Write outputs for SQL queries (i) to (iii) which are based on the given 3
table PURCHASE.
Table : PURCHASE
CNO CNAME CITY QUANTITY DOP
C01 GURPREET NEW DELHI 150 2022-06-11
C02 MALIKA HYDERABAD 10 2022-02-19
C03 NADAR DALHOUSIE 100 2021-12-04
C04 SAHIB CHANDIGARH 50 2021-10-10
C05 MEHAK CHANDIGARH 15 2021-10-20
i. SELECT LENGTH(CNAME) FROM PURCHASE WHERE
QUANTITY>100;
ii. SELECT CNAME FROM PURCHASE WHERE MONTH(DOP)=3;
iii. SELECT MOD(QUANTITY,DAY(DOP)) FROM PURCHASE WHERE
CITY = ‘CHANDIGARH’;
10 Observe the table student carefully and answer questions given 4
below.Table : Student
SID SNAME CLASS HOUSE FEES ADMYEAR
S1021 AMAN 12 RED 2400 2016
S1022 SUNIL 11 RED 2400 2015
S1023 REENA 10 BLUE 1800 2014
S1024 MOHIT 12 BLUE 3150 2016
S1025 VINIT 11 GREEN 2700 2021
S1026 MAYA 10 GREEN 1800 2022
S1027 JAMES 12 YELLOW 2900 2020
S1028 DIPAK 11 YELLOW 2900 2019

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;

11 Write suitable SQL query for the following: 5


i. Display 7 characters extracted from 7th left character
onwards from the string ‘INDIA SHINING’
ii. Display the position of occurrence of string ‘COME’ in the
string ‘WELCOME WORLD’.
iii. Round off the value 23.78 to one decimal place.
iv. Display the remainder of 100 divided by 9.
v. Remove all the expected leading and trailing spaces from a
column userid of the table ‘USERS’.

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy