Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

World Traveler Cruise Line SHIP Ship Nurriter Ship Name Weight Year Built Passenger Capacity CRUISE Cruise Serial Number Sailing Date Return Date VISITS Visit Order

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

World Traveler Cruise Line SHIP Ship Nurriter Ship Name Weight Year Built Passenger Capacity CRUISE Cruise Serial Number Sailing Date Return Date VISITS Visit Order BOOKING Price Satisfaction Rate PORT PortID Port Name Country Docking Fee PASSENGER Passenger Number Name (First Name, Middle Name, last Name) Address (Street Address, City, State, Postal Code, Country) SHIP ShiplD ShipName Weight YearBuilt PassengerCapacity CRUISE CruiseSerialNo SailingDate ReturnDate ShipID Booking CruiseSerialNo Passengerid Price Satisfaction Rate Passenger PassengerID PFirstName PlastName PStreetAddress PCity PState PPostalCode PCountry VISIT CruiseSerialNo PortID VisitOrder PORT Portid PortName PortCountry DockingFee Assignment 3 Instructions Create a database in SQLServer for the relational model provided in the HW3- Relational Schema file. Populate your database with some data to test your database. Write the requested queries in SQL. The relational model that is provided is part of the relational model from your HW 2, however it has been simplified. The E-R diagram for this relational model is also provided to you in the HW3_Data Model file First create an SQL Server database by right clicking on the databases folder in the Object explorer and selecting the New Database option. Name the database by the initials of your last names and then A3. For instance a database created by Johnson and White would be named as jw_A3. Write the SQL statements for creating the tables in your database, specifying data types and field lengths, establishing primary keys and foreign keys, and implementing all the necessary constraints. Save your create statements in a file. Use the same naming convention you used to name your database to name your file. In your file also include the following SQL statements 1. An SQL statement to add a constraint to one of the tables. 2. An SQL statement to add a column to one of the tables. 3. An SQL statement to insert data to one of the tables 4. An SQL statement to modify the data in one of the tables. 5. An SQL statement to delete a row of data from one of the tables. Populate your database with sample data. Write the following SQL queries and save them in your file also. Put the question numbers above your queries, e.g. 01, 02, 03 etc. Ensure that your queries are correct and produce the results you expected. 1. List all passengers who live in Istanbul sorted by last name and then by first name. 2. What is the number of passengers whose city was not specified (i.e., IS NULL)? 3. Display shipname YearBuilt Passengeccapacity PartName for ships that visited the ports. 4. Display ShieName, Cruise Seriale Sailing Date PortName, PortCountry, and VisitOrdec for all the ships that have been assigned to a cruise. 5. List the cruises which have more than 10 bookings? 6. Determine the total docking fee for each cruise. 7. Determine the total price paid by each passenger and display FirstName PlastName and total price paid. 8. Which cruises have Istanbul as the departure port (Hint: the visit order should be equal to 1) 9. Which passengers have visited Venice in October 2015? (Hint: you may use the Month and Year functions on SalingDate and see if Sailing Date was in October 2015.) 10. What is the duration of each cruise (Hint: Use the DATEDIFF function to determine the duration) 11. What is the number of bookings on each cruise? Display scriseld and number of bookings. 12. What is the average rating of all the cruises? 13. What is the average rating for cruise with Cruisesecialne = 1 14. Which cruises have an average rating greater than the overall average rating? Display sculseld and average rating 15. Display the ports visited by the cruise, which has the longest duration. (Display PartName, PortCountry, and Cruisel) 16. List the ships which have not been assigned a cruise yet. 17. What is the average number of cruises that a ship sails? (Hint: write a subquery to calculate the count of cruises a ship sails, then using that as the data source take the average of the count of cruises.) 18. Which port has the highest docking fee? Submit your SQL Server database creation query file and your select query file through LMS (one submission for each group) by the due date

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions