Which of the following query finds colors of boats reserved by "Dustin"?
A. SELECT DISTINCT b.color FROM boats b, sailors s WHERE s.sname = 'Dustin' AND s.sid = b.sid
B. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid AND r.bid = b.bid;
C. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid
D. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND r.bid = b.bid
Answer: Option B
Solution(By Examveda Team)
To find the colors of boats reserved by "Dustin," you should use the SQL query SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid AND r.bid = b.bid; (Option B). This query joins the "boats," "reserves," and "sailors" tables to find the colors of boats reserved by "Dustin." It ensures that the sailor's name is "Dustin" (s.sname = 'Dustin') and matches the sailor's ID to the reservation's sailor ID (s.sid = r.sid) and the reservation's boat ID to the boat's ID (r.bid = b.bid). The use of DISTINCT ensures you get unique boat colors. Option B is the correct choice for obtaining this information.Join The Discussion
Comments ( 2 )
A. Structured Query Language
B. Structured Query List
C. Simple Query Language
D. None of these
Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
A. Data Definition Language(DDL)
B. Data Manipulation Language(DML)
C. Both of above
D. None
Which operator performs pattern matching?
A. BETWEEN operator
B. LIKE operator
C. EXISTS operator
D. None of these
What operator tests column for the absence of data?
A. EXISTS operator
B. NOT operator
C. IS NULL operator
D. None of these
what is the meaning of sid and bid????
what bid here?????