Question: Write and run the following queries. Do not show duplicates 1. Print the names of sailors who have reserved at least two boats 2. Print
Write and run the following queries. Do not show duplicates
1. Print the names of sailors who have reserved at least two boats 2. Print the names of sailors whose rating is within (inclusive) 5 and 8 and have reserved more than two boats 3. Find the average age of sailors who have a rating greater than 7 and have reserved a boat named Clipper or Interlake 4. Find the age of the oldest sailor for each rating level that has reserved a red boat 5. Find the sailors whose rating is worse than some sailor named Andy
CREATE TABLE boats( bid integer, bname char(20), color char (20), PRIMARY KEY (bid)); CREATE TABLE sailors(sid integer, sname char(30) rating number, age number PRIMARY KEY (sid)); CREATE TABLE reserves sid integer, bid integer, day date, PRIMARY KEY (sid,bid,day), CONSTRAINT FK. BID-RES FOREIGN CONSTRAINT FK. SID-RES FOREIGN KEY KEY (bid) (sid) REFERENCES boats(bid), REFERENCES sailors(sid))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
