Question:medium

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: Feb 16, 2026
  • 30
  • 22.5
  • 90
  • 23
Show Solution

The Correct Option is A

Solution and Explanation

Step 1: AVG Function Behavior.
The SQL AVG() function computes the arithmetic mean of a column, specifically excluding NULL values.
Step 2: Valid Data Identification.
From the MARKS column: 20, 40, NULL, 30.
Excluding NULLs, the valid data points are: 20, 40, 30.
Step 3: Average Calculation.
\[\text{Average} = \frac{20 + 40 + 30}{3} = \frac{90}{3} = 30\]
Step 4: Incorrect Option Exclusion.
- Option 2 (22.5): Incorrect. This calculation incorrectly includes NULL as a data point (4 rows).
- Option 3 (90): Incorrect. This represents the sum, not the average.
- Option 4 (23): Incorrect. This is not the result of a correct calculation.

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