Examveda
Examveda

Which of the following query finds the total rating of the sailors who have reserved boat "103"?

A. SELECT SUM(s.rating) FROM sailors s, reserves r AND r.bid = 103;

B. SELECT s.rating FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103

C. SELECT COUNT(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103

D. SELECT SUM(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103

Answer: Option D

Solution(By Examveda Team)

To find the total rating of the sailors who have reserved boat "103," you should use the SQL query SELECT SUM(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103; (Option D). This query correctly joins the "sailors" and "reserves" tables on the sailor ID (s.sid) and specifies the boat ID (r.bid) to be "103." It then calculates the sum of the ratings (s.rating) of the sailors who have reserved this boat. Option D is the correct choice for achieving this result.

This Question Belongs to SQL >> Sql Miscellaneous

Join The Discussion

Related Questions on Sql Miscellaneous