Consider two tables in a relational database with columns and rows as follows:…

GATE · 2004 · IT

Consider two tables in a relational database with columns and rows as follows:

image.png

Roll_no is the primary key of the Student table, Dept_id is the primary key of the Department table and Student.Dept_id is a foreign key from Department.Dept_id What will happen if we try to execute the following two SQL statements?

  1. update Student set Dept_id = Null where Roll_no = 1
  2. update Department set Dept_id = Null where Dept_id = 1

  1. A.

    Both (i) and (ii) will fail

  2. B.

    (i) will fail but (ii) will succeed

  3. C.

    (i) will succeed but (ii) will fail

  4. D.

    Both (i) and (ii) will succeed

Attempted by 839 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…