Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Workshop Week 8 MySQL Practical Exercise Exercise 1 This exercise is similar to week 5 . Students at this stage should be illustrated how to
Workshop Week MySQL Practical Exercise
Exercise
This exercise is similar to week Students at this stage should be illustrated how to create tables, alter tables, and write complex SQL queries.
Note: Use SQL commands to create the database, tables, records, and Queries.
Create the database sbrcommands and the following tables sailors, boats, and reserves which are reproduced as follows:
sailorssid: VARCHAR PK sname: VARCHAR rating: SMALLINT, age: DOUBLE
boatsbid: VARCHAR PK bname: VARCHAR colour: VARCHAR
reservessid: VARCHAR FK bid: VARCHAR FK day: DATE
sid sname rating age sid bid Day bid bname colour
Dustin Interlake blue
Brutus Interlake red
Lubber Clipper green
Andy Marine red
Rusty
Horatio Boats
Zorba
Horatio
Art
Bob
Sailors Reserves
Enter the test data for the three tables as shown above.
Using DISTINCT.
Formulate SQL query to find all information of sailors who have reserved boat number
Formulate SQL query to find the names of sailors who have reserved a red boat, and list in the order of age.
Find the names of sailors who have reserved at least one boat.
Count the number of different sailor names.
Calculate the average age of all sailors.
Find the ages of sailors whose name begins and ends with B and has at least characters.
Find the sailors with the highest rating.
Find the name of the oldest sailor.
Find name of the sailors whose rating is greater than equal to
Find boat id name and color of the boats whose color is not blue and red.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started