SQL Aggregate Function

6.Output of this query?
Table: sales id | amount 1 | 100 2 | 200 3 | NULL SELECT SUM(amount) FROM sales;
  • A. 300
  • B. 0
  • C. NULL
  • D. Error

300

300

7.What is returned by: If 2 out of 5 products have NULL in price column.
SELECT COUNT(price) FROM products;
  • A. 5
  • B. 2
  • C. 3
  • D. 0

3

3

8.Which query shows average marks of each subject?
SELECT subject, AVG(marks) FROM results GROUP BY subject;
  • A. Correct
  • B. Error: GROUP BY not allowed
  • C. SUM should be used
  • D. Use JOIN instead

Correct

Correct

9.What does this return?
SELECT MAX(salary) FROM employees;
  • A. Employee name
  • B. Total salary
  • C. Highest salary value
  • D. NULL

Highest salary value

Highest salary value