0% found this document useful (0 votes)
14 views2 pages

Assignment No 02

Uploaded by

dojosarvesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Assignment No 02

Uploaded by

dojosarvesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment No.

02

SQL Quries

Q1. Write SQL query to create above tables.


Sailors(sid: integer, sname: string, rating: integer, age: real)
Boats(bid: integer, bname: string, color: string)
Reserves(sid: integer, bid: integer, day: date)

Q2. Write SQL query to insert one row in each table.

Answer the following questions using SQL Queries


Count the number of sailors.
Count the number of different sailor names.
Find the names of sailors who are older than the oldest sailor with a rating of 10.
Find the age of the youngest sailor for each rating level.
Find the age of the youngest sailor who is eligible to vote (i.e., is at least 18 years old) for each rating
level with at least two such sailors.
For each red boat, find the number of reservations for this boat
Find the average age of sailors for each rating level that has at least two sailors.
Find the average age of sailors who are of voting age (i.e., at least 18 years old) for each rating level
that has at least two sailors.
Find the average age of sailors who are of voting age (i.e., at least 18 years old) for each rating level
that has at least two such sailors
Find those ratings for which the average age of sailors is the minimum overall ratings.

You might also like