0% found this document useful (0 votes)
3 views6 pages

As 7

The document outlines an assignment to create three database tables: sailor, boat, and reserve, along with SQL code for inserting data and querying information. It includes tasks such as displaying the tables, finding sailors who have reserved specific boats, and performing various queries related to sailors and boats. The assignment emphasizes SQL operations like SELECT, INSERT, and aggregate functions.

Uploaded by

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

As 7

The document outlines an assignment to create three database tables: sailor, boat, and reserve, along with SQL code for inserting data and querying information. It includes tasks such as displaying the tables, finding sailors who have reserved specific boats, and performing various queries related to sailors and boats. The assignment emphasizes SQL operations like SELECT, INSERT, and aggregate functions.

Uploaded by

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

Assignment 7

i) Create three tables as follows:


a. sailor (s_id, s_name, s_rating, s_age)
b. boat (b_id, b_name, color, s_id)
c. reserve (s_id, b_id, hire_date)
Ans.
a.
code:

b.
Code:

c.
Code:
ii. Insert five rows into sailor, boat and reserve tables.
Ans.
INSERT INTO sailor
Code:

INSERT INTO boat


Code:

INSERT INTO reserve


Code:

iii. Display three tables.


Ans.
Code:
SELECT * FROM sailor;
Output:
Code:
SELECT * FROM boat;
Output:

Code:
SELECT * FROM reserve;

3
Output:

iv. Find all information of sailor who have reserve boat


number 101.
Ans.
Code:

Output:

3
v. Find the name of boat reserve by sailor name.
Ans.
Code:

Output:

vi. Find the name of sailor who have reserved at least one
boat.
Ans.
Code:

Output:

vii. Find the name of sailor who have reserved different boat
on same date
Ans.
Code:

Output:

viii. Find the name of sailor who have reserved a red boat or
green boat
Ans.
Code:

Output:

ix. Find the name and age of youngest sailor.

Ans.
Code:

5
Output:

x. Count the number of different sailor name.


Ans.
Code:

Output:

xi. Find the average age of sailor for each rating levels.
Ans.
Code:

Output:

You might also like