The document describes creating a database called boatsreservation with tables to store information about sailors, boats, and boat reservations. It includes queries to insert sample records and retrieve information, such as getting the names of sailors who have reserved red or green boats, the IDs of sailors who have reserved a specific boat, and combining sailor names and ages with boat names and colors.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
47 views
Database SQL
The document describes creating a database called boatsreservation with tables to store information about sailors, boats, and boat reservations. It includes queries to insert sample records and retrieve information, such as getting the names of sailors who have reserved red or green boats, the IDs of sailors who have reserved a specific boat, and combining sailor names and ages with boat names and colors.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
Part 2
1.Create database boatsreservation
2. Create the tables above (show statement/s in creating the tables).
3. Create queries to insert records to their respective tables.
Part 3 1. Name of all the sailors. Select sname from sailors; 2. Name of all sailors who reserve boats more than once in the same day. select sid, bid, day from reserves where sid AND day > 2; 3. Name of all sailors who reserve boats with color red or green. Select sid from reserves where color=’red’ OR ‘green’; 4. Name of all sailors who reserve boats with color red and green. Select sid from reserves where color=’red’ AND ‘green’; 5. ID numbers of all sailors who reserve boat with 104 as bid. Select sid from reserves bid like=’%104%’; 6. Name of sailors who never reserve boat. Select sid 7. All sailors with ‘o’ in their name. Select * from sailor where sname like ‘%o%’; 8. Name of all sailors and name of boat/s they reserved. Select * from reserves where sid=’bname’; 9. Name of sailors and color of boat with rating of less than 5.
10. Combine sailor name and age with boat name and color.