0% found this document useful (0 votes)
7 views2 pages

Chapter4 Worksheet AggregateFunctions 1

This worksheet for Grade XII students at The Emirates National School focuses on database queries using MySQL, specifically on aggregate functions. It includes questions on identifying functions, writing SQL commands, and differentiating between single row and aggregate functions. Additionally, it presents practical exercises involving SQL statements and table structures to reinforce learning of database concepts.
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)
7 views2 pages

Chapter4 Worksheet AggregateFunctions 1

This worksheet for Grade XII students at The Emirates National School focuses on database queries using MySQL, specifically on aggregate functions. It includes questions on identifying functions, writing SQL commands, and differentiating between single row and aggregate functions. Additionally, it presents practical exercises involving SQL statements and table structures to reinforce learning of database concepts.
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

THE EMIRATES NATIONAL SCHOOL – SHARJAH

INFORMATICS PRACTICES Worksheet


Grade XII (2025 – ‘26)
CHAPTER 4 – Database Query Using MySQL

Aggregate Functions – Worksheet 1


1) Name the following:
a) Functions that work with data of multiple rows at a time and returns a value.
b) Aggregate functions are also known as ___________.
c) The function that returns the total number of rows in a table.
d) The clause used in a query to place a condition on individual rows.
e) Single row functions are also known as ____________.
f) The type of value ignored by aggregate functions.
2) Name any two aggregate functions.
3) Write MySQL command to create a table PAYMENT whose structure is given below:
FIELDNAME DATATYPE SIZE CONSTRAINT

Loan_Number Integer 4 Primary Key

Payment_Number Varchar 3

Payment_Date Date

Payment_Amount Integer 8 Not Null

4) Consider the table COMPANY:


SID SALES
S101 20000
S102 NULL
S103 10000
S104 15000

What output will be displayed by the following SQL statement?


a) SELECT AVG(SALES) FROM COMPANY;
b) SELECT COUNT(*) FROM COMPANY;
c) SELECT COUNT(SALES) FROM COMPANY;
d) SELECT SALES + 1000 FROM COMPANY
e) SELECT SUM(SALES), MIN(SALES), MAX(SALES) FROM COMPANY;

5) Differentiate between single row and aggregate functions.


6) Differentiate between COUNT(*) and COUNT() functions.
7) Consider the table WORKER and answer the questions:
TABLE: WORKER
ECODE NAME DESIG PLEVEL DOJ DOB

11 Sachin Patel Supervisor P001 13-Sep-2004 23-Aug_1985

12 Chander Nath Operator P003 22-Feb-2010 12-Jul-1987

13 Fizza Operator P003 14-Jun-2009 14-Oct-1983

15 Ameen Ahmed Mechanic P002 21-Aug-2006 13-Mar-1984

18 Sanya Clerk P002 19-Dec-2005 09-Jun-1983

a) Identify the Primary Key of the above table with justification. Can PLEVEL be set as the
Primary key? Give reason.
b) Mention the datatype of the attribute PLEVEL.
c) Write the degree and cardinality of the above table.
Write SQL commands for the following:
d) To display details of all workers in descending order of date of birth
e) To display the name and designation of those workers whose PLEVEL is either P001 or P002.
f) To find the number of workers in the above table.
g) To display the details of workers that contain the letter ‘c’ anywhere in their name.
h) To find the earliest date of joining.
Write output for the following:
i) SELECT MAX(DOB), MIN(DOJ) FROM WORKER;
j) SELECT DISTINCT DESIG FROM WORKER;
k) SELECT COUNT(DISTINCT PLEVEL) FROM WORKER;
l) SELECT MIN(YEAR(DOJ)) FROM WORKER;

8) Name any two aggregate functions that can be used only with numeric data types.
9) Name the clause used with Pattern Matching in Strings and the wild card characters used with it.

You might also like