Find the output of the MySQL query based on the given Table COACH. Ignore the…
2023
Find the output of the MySQL query based on the given Table COACH. Ignore the output header.
Relevant columns of Table COACH:
GAME | SALARY
NULL | NULL
CRICKET | 60000
ATHLETICS | 80000
CRICKET | NULL
Query:
SELECT COUNT(GAME), AVG(SALARY) FROM COACH;
- A.
3 70000
- B.
4 35000
- C.
4 70000
- D.
3 35000
Attempted by 1497 students.
Show answer & explanation
Correct answer: A
COUNT(GAME) = 3 and AVG(SALARY) = 70000.
COUNT(GAME) counts only non-NULL entries in GAME. The values are NULL, CRICKET, ATHLETICS and CRICKET, so 3 values are counted.
AVG(SALARY) also ignores NULL values. The non-NULL salaries are 60000 and 80000, so (60000 + 80000) / 2 = 70000.
Ignoring column headers, the output is: 3 70000.