0% found this document useful (0 votes)
9 views

lecture_9_quiz

The document contains a series of true/false questions and multiple-choice questions related to SQL functions and clauses. Key points include the correct use of the WHERE and HAVING clauses, the identification of aggregate functions, and the behavior of the COUNT function with null values. It emphasizes the importance of understanding group functions and their application in SQL queries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

lecture_9_quiz

The document contains a series of true/false questions and multiple-choice questions related to SQL functions and clauses. Key points include the correct use of the WHERE and HAVING clauses, the identification of aggregate functions, and the behavior of the COUNT function with null values. It emphasizes the importance of understanding group functions and their application in SQL queries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

The WHERE clause restricts rows before inclusion in a group calculation.

A. True
B. False
ANSWER: A
Group functions work across many rows to produce one result per group.
A. True
B. False
ANSWER: A
Group functions include null calculations.
A. True
B. False
ANSWER: B
The TO_NUMBER function converts either character strings or date values to a number
in the format specified by the optional format model.
A. True
B. False
ANSWER: B
Identify the correct aggregate functions that can be used in sql(choose 3 answers)
A. SUM()
B. MINIMUM()
C. AVG()
D. MIN()
ANSWER: A, C, D
Which of the following is not a valid SQL statement?
A. SELECT MIN(pubdate) FROM books GROUP BY category HAVING pubid = 4;
B. SELECT MIN(pubdate) FROM books WHERE category = 'COOKING';
C. SELECT COUNT(*) FROM orders WHERE customer = 1005;
D. SELECT MAX(COUNT(customer)) FROM orders GROUP BY customer;
ANSWER: A
We can also use the GROUP BY statement on more than one column.
A. True
B. False
ANSWER: A
The HAVING clause is added to SQL because the WHERE keyword cannot be used with
aggregate functions.
A. True
B. False
ANSWER: A
Which of the following functions is not single row functions?
A. SUM
B. TRUNC
C. TRIM
D. SUBSTR
ANSWER: A
Consider the EMPLOYEES table. Which of the following statements calculate the
minimum salary within each department, displaying only those rows where minimum
salary is greater than 5000?
A. SELECT department, MIN(salary) FROM employees GROUP BY department HAVING
MIN(salary)>5000;
B. SELECT department, MIN(salary) FROM employees WHERE MIN(salary) > 5000 GROUP BY
department;
C. SELECT department, salary FROM employees WHERE MIN(salary) > 5000;
D. SELECT department, salary FROM employees GROUP BY department, HAVING salary
>5000;
ANSWER: A
A table t_1 has 12 number values as 1, 2, 3, 32, 1, 1, null, 24, 12, null, 32,
null. Predict the output of the below query.
SELECT COUNT(*) FROM t_1;
A. 12
B. 6
C. 9
D. Throws exception because COUNT function doesn't works with NULL values
ANSWER: A

You might also like