Page 194 - Informatics_Practices_Fliipbook_Class12
P. 194
Previous Years' Questions
1. Which of the following is the correct output of the following SQL command? [2023]
SELECT ROUND (7876.4568, 2);
a. 7876.46 b. 7876.45
c. 7900 d. 7900.4568
Ans. a. 7876.46
2. Aggregate functions are also known as: [2023]
a. Scalar Functions b. Single Row Functions
c. Multiple Row Functions d. Hybrid Functions
Ans. c. Multiple Row Functions
3. Ravisha has stored the records of all students of her class in a MYSQL table. Suggest a suitable SQL clause that she should
use to display the names of students in alphabetical order. [2023]
a. SORT BY b. ALIGN BY
c. GROUP BY d. ORDER BY
Ans. d. ORDER BY
4. To remove the leading and trailing space from data values in a column of MySql Table, we use [2023]
a. Left b. Right()
c. Trim() d. Ltrim()
Ans. c. Trim()
5. If the substring is not present in a string, the INSTR() returns: [2023]
a. -1 b. 1
b. NULL d. 0
Ans. d. 0
6. Which of the following is not a valid aggregate function in MYSQL? [2023]
a. COUNT() b. SUM()
c. MAX() d. LEN()
Ans. d. LEN()
7. Keshav has written the following query to find out the sum of bonus earned by the employees of WEST zone: [2023]
SELECT zone, TOTAL (bonus) FROM employee HAVING Zone = "WEST';
But he got an error. Identify the errors and rewrite the query by underlining the correction(s) done.
Ans. select zone, sum(bonus) from employee having zone='West'
OR
select zone, sum(bonus) from employee where zone ='West';
8. Differentiate between COUNT() and COUNT(*) functions in MYSQL. Give suitable examples to support your answer. [2023]
Ans.
COUNT() COUNT(*)
It counts and returns records except null values from It counts and returns all values including null values.
specified column.
It takes column name in the parenthesis. It takes * in the parenthesis.
It is very effective to count unique records from table. It is not effective to count unique records from table.
Ex.: select count(dpetno) from emp; Ex. select count(*) from emp;
180 Touchpad Informatics Practices-XII

