Examveda
Examveda

Which of the following query finds the names of the sailors who have reserved at least one boat?

A. SELECT DISTINCT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid;

B. SELECT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid;

C. SELECT DISTINCT s.sname FROM sailors, reserves WHERE s.sid = r.sid;

D. None of These

Answer: Option A

Solution(By Examveda Team)

To find the names of sailors who have reserved at least one boat, you should use the SQL query SELECT DISTINCT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid; (Option A). This query joins the "sailors" and "reserves" tables on the "sid" column and selects the distinct "sname" (sailor names) from the "sailors" table. The use of DISTINCT ensures that you only get unique sailor names. Option A is the correct choice for achieving this result.

This Question Belongs to SQL >> Sql Miscellaneous

Join The Discussion

Related Questions on Sql Miscellaneous