Thursday, June 7, 2007

Question 72

Which of the following SQL statements provides the same results as the SQL statement shown below for a “dealer” table and “supplier” table? In this example, the dealer and supplier tables are structured as shown below. (The underlining denotes primary keys.)

Dealer (Dealer_ number, Dealer_name)
Supplier (Product_number, Dealer_number)

SELECT Dealer_name FROM Dealer, Supplier
WHERE Dealer.Dealer_number = Supplier.Dealer_number AND Product_number = 100

a) SELECT Dealer_name FROM Dealer WHERE NOT EXISTS
( SELECT * FROM Supplier WHERE Product_number = 100 )

b) SELECT Dealer_name FROM Dealer WHERE NOT EXISTS
( SELECT Product_number FROM Supplier WHERE Product_number = 100 )

c) SELECT Dealer_name FROM Dealer WHERE Dealer_number IN
( SELECT Dealer_number FROM Supplier WHERE Product_number = 100 )

d) SELECT Dealer_name FROM Dealer WHERE Product_number IN
( SELECT Product_number FROM Supplier WHERE Product_number = 100 )

answer

No comments: