SQL
October 4, 2023SQL
October 4, 2023Database-Management-System
Question 37 |
Consider a database with three relation instances shown below. The primary keys for the Drivers and Cars relation are did and cid respectively and the records are stored in ascending order of these primary keys as given in the tables. No indexing is available
What is the output of the following SQL query?
select D.dname from Drivers D where D.did in ( select R.did from Cars C, Reserves R where R.cid = C.cid and C.colour = 'red' intersect select R.did from Cars C, Reserves R where R.cid = C.cid and C.colour = 'green' )
Karthikeyan, Boris | |
Sachin, Salman | |
Karthikeyan, Boris, Sachin | |
Schumacher, Senna
|
Question 37 Explanation:
For colour = “Red”
did = {22, 22, 31, 31, 64}
For colour = “Green”
did = {22, 31, 74}
Intersection of Red and Green will be = {22, 31}, which is Karthikeyan and Boris.
did = {22, 22, 31, 31, 64}
For colour = “Green”
did = {22, 31, 74}
Intersection of Red and Green will be = {22, 31}, which is Karthikeyan and Boris.
Correct Answer: A
Question 37 Explanation:
For colour = “Red”
did = {22, 22, 31, 31, 64}
For colour = “Green”
did = {22, 31, 74}
Intersection of Red and Green will be = {22, 31}, which is Karthikeyan and Boris.
did = {22, 22, 31, 31, 64}
For colour = “Green”
did = {22, 31, 74}
Intersection of Red and Green will be = {22, 31}, which is Karthikeyan and Boris.
Subscribe
Login
0 Comments