Skip to content
Related Articles

Related Articles

Improve Article

GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 61

  • Last Updated : 21 Jan, 2020

Consider the following schema:

Person(SSN, name, address)
Car(license, year, model)
Accident(license, accident_date, driver, damage_amount)
Owns(SSN, license) 

Primary keys are underlined. Note that the driver involved in a car accident may not always be the owner of the car. Assume that accident_date is of type integer, and represents a year (e.g. 1980). Year is also of type integer. Also, assume that a car cannot get involved in more than one accident at a certain date.

Which of the following query is correct to find the SSN of every person who owns one or more cars, none of which has ever been involved in a car accident.
(A)

SELECT O.SSN
FROM Owns O
WHERE O.license NOT IN (SELECT A.license
                        FROM Accident A) 

(B)

πSSN(Owns) - πSSN(Owns ⨝ Accident) 

(C)



{ O | ∃O1 ∈ Owns( O.SSN = O1.SSN ∧ ¬∃A∈ Accident( O1.license = A.license )) } 

(D) All of the above.


Answer: (B)

Explanation: Only option (B) is correct.

Option (A) and option (C) return the SSN of every person that has at least one car that is not involved in an accident, while the question asks for the people for whom all of their cars have never been involved in an accident.

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :