Vidyalelo
SQL · Q37

SQL

Programming · SQL · question 37

Q37

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;
Answer
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

Answer: Option A
Solution:
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.