Question:

Given Relation: \texttt{STUDENT} \begin{center} \begin{tabular}{|c|c|c|} \hline SNO & SNAME & MARKS
\hline 1 & Amit & 20
2 & Karuna & 40
3 & Kavita & NULL
4 & Anuj & 30
\hline \end{tabular} \end{center} Find the value of: \begin{verbatim} SELECT AVG(MARKS) FROM STUDENT; \end{verbatim}

Show Hint

The AVG() function always ignores NULL values. To include NULLs as zero, you must use \texttt{COALESCE} or similar functions.
Updated On: Sep 18, 2025
  • 30
  • 22.5
  • 90
  • 23
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Understanding AVG function.
The AVG() function in SQL calculates the arithmetic mean of a column but it ignores NULL values.
Step 2: Identify valid values.
From the table: MARKS = 20, 40, NULL, 30.
Ignoring NULL → valid values = 20, 40, 30.
Step 3: Calculate average.
\[ \text{Average} = \frac{20 + 40 + 30}{3} = \frac{90}{3} = 30 \]
Step 4: Eliminate incorrect options.
- Option 2 (22.5): Wrong, as it assumes 4 rows (including NULL).
- Option 3 (90): Wrong, that is the sum, not average.
- Option 4 (23): Wrong, not a correct calculation.

Final Answer: \[ \boxed{30} \]
Was this answer helpful?
0
0

Questions Asked in CUET exam

View More Questions