Exercise 5.5 Consider the instance of the Sailors relation shown in Figure 5.1. 1. Write SQL queries to compute the average rating, using AVG; the sum of the ratings, using SUM; and the number of...

No/ sqlExercise 5.5 Consider the instance of the Sailors relation shown in Figure 5.1.<br>1. Write SQL queries to compute the average rating, using AVG; the sum of the<br>ratings, using SUM; and the number of ratings, using COUNT.<br>2. If you divide the sum just computed by the count, would the result be the same<br>as the average? How would your answer change if these steps were carried out<br>with respect to the age field instead of rating?<br>3. Consider the following query: Find the names of sailors with a higher rating than<br>all sailors with age < 21. The following two SQL queries attempt to obtain the<br>answer to this question. Do they both compute the result? If not, explain why.<br>Under what conditions would they compute the same result?<br>SELECT S.sname<br>FROM<br>Sailors S<br>WHERE<br>NOT EXISTS<br>SELECT<br>FROM<br>Sailors S2<br>WHERE S2.age < 21<br>AND S.rating <= S2.rating )<br>

Extracted text: Exercise 5.5 Consider the instance of the Sailors relation shown in Figure 5.1. 1. Write SQL queries to compute the average rating, using AVG; the sum of the ratings, using SUM; and the number of ratings, using COUNT. 2. If you divide the sum just computed by the count, would the result be the same as the average? How would your answer change if these steps were carried out with respect to the age field instead of rating? 3. Consider the following query: Find the names of sailors with a higher rating than all sailors with age < 21.="" the="" following="" two="" sql="" queries="" attempt="" to="" obtain="" the="" answer="" to="" this="" question.="" do="" they="" both="" compute="" the="" result?="" if="" not,="" explain="" why.="" under="" what="" conditions="" would="" they="" compute="" the="" same="" result?="" select="" s.sname="" from="" sailors="" s="" where="" not="" exists="" select="" from="" sailors="" s2="" where="" s2.age="">< 21="" and="" s.rating=""><= s2.rating="">

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here