The document contains a 10 question SQL quiz about aggregate functions, GROUP BY clauses, single and multiple row functions, HAVING vs WHERE clauses, and writing SQL queries to analyze and summarize data from various tables. Students are asked to write SQL queries to calculate totals, averages, counts, minimums, maximums from tables containing data on employees, items purchased, vehicles, and exam results to demonstrate their understanding of SQL functions and clauses.
The document contains a 10 question SQL quiz about aggregate functions, GROUP BY clauses, single and multiple row functions, HAVING vs WHERE clauses, and writing SQL queries to analyze and summarize data from various tables. Students are asked to write SQL queries to calculate totals, averages, counts, minimums, maximums from tables containing data on employees, items purchased, vehicles, and exam results to demonstrate their understanding of SQL functions and clauses.
The document contains a 10 question SQL quiz about aggregate functions, GROUP BY clauses, single and multiple row functions, HAVING vs WHERE clauses, and writing SQL queries to analyze and summarize data from various tables. Students are asked to write SQL queries to calculate totals, averages, counts, minimums, maximums from tables containing data on employees, items purchased, vehicles, and exam results to demonstrate their understanding of SQL functions and clauses.
INFORMATICS PRACTICES (065) Std. XII TIME: 40 Mins. Mark: 20
ANSWER THE FOLLOWING
1. What are Aggregate functions? (1)
2. What is the significance of GROUP By clause in a SQL query? (1) 3. Explain any two differences between single-row functions and multiple-row functions. (2) 4. What is the difference between HAVING and WHERE clauses? Explain with the help of an example. (2) 5. Anjali writes the following commands with respect to a table Employee having fields, empno, name, department, commission. Command1: Select count (*) from employee; Command2: Select count (commission) from employee; She gets the output 4 for the first command but get an output 3 for the second command. Explain the output with justification. (2) 6. Gopi Krishna is using a table Employee. It has the following columns : (1) Code, Name, Salary, Deptcode He wants to display maximum salary department wise. He wrote the following command: SELECT Deptcode, Max (Salary) FROM Employee; But he did not get the desired result. Rewrite the above query with necessary changes to help him get the desired output. 7. Explain the max () and min () functions with an example for each. (2) 8. Mr. Piyush has created the following table Items in his shops’s database: (3)
Find the output of the following 3 queries:
(a) select sum (unitprice) from Items where discount <10;
(b) select min(dayofmonth(DatePurchase)) from Items; (c) Select year(curdate())-year(DatePurchase) from Items where UnitPrice>1000; 9. A relation Vehicles is given below : (3)
Write SQL Commands to:
(a) Display the average price of each type of vehicle having quantity more than 20. (b) Count the type of vehicles manufactured by each company. (c) Display the total price of all the types of vehicles.
10. Gautami has created the following table EXAM (3)
Help her write SQL queries for the following:
(a) Display number of students stream wise.
(b) Display total number of students in the table. (c) Display the number of students in 12B.