A table T1 in a relational database has the following rows and columns: The…

2004

A table T1 in a relational database has the following rows and columns:

image.png

The following sequence of SQL statements was successfully executed on table T1.

Update T1 set marks = marks + 5
Select avg(marks) from T1

What is the output of the select statement?

  1. A.

    18.75

  2. B.

    20

  3. C.

    25

  4. D.

    NULL

Attempted by 646 students.

Show answer & explanation

Correct answer: C

  • Initial marks values in table T1:
    10, 20, 30, NULL

  • After executing

    UPDATE T1 SET marks = marks + 5;
    

    Updated values become:
    15, 25, 35, NULL
    (Note: NULL + 5 = NULL)

  • AVG(marks) ignores NULL values.

image.png

Explore the full course: Gate Guidance By Sanchit Sir