Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you answer the questions I squared on the red below? Thank you very much, I really appreciate your work. Create a database in SQLServer

Can you answer the questions I squared on the red below? Thank you very much, I really appreciate your work. image text in transcribed

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 SHIP Shield ShipName Weight Yeardult PassengerCapacity CRUISE Cruseseria No Saling Date ReturnDate Shelp Booking Cruiser Passenger Price Satisfactionate Passenger Passenger PfirstName PlastName PStreetAddress Poity PState Postal Code PCountry VISIT CruiseSeria Ne Porto VisitOrder PORT Portid PortName PortCountry Dockingfee World Traveler Cruise Line 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. Q1, Q2, Q3 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, Year Built, PassengerCapacity, PortName for ships that visited the ports. 4. Display ShipName, Cruise SerialNo, SailingDate, PortName, PortCountry and VisitOrder 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. Determ e the total price paid by each passenger and display PFirstName, PlastName and total price paid. Which cruises have Istanbul as the departure port (Hint: the visit order should be equal Can you please answer the questions squared on with red above. 9. Whithank you very much appreciate your workth and Year functions on Sailing Date and see if SailingDate 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 cruiseld and number of bookings 12. What is the average rating of all the cruises? SHIP Ship Mamber Ship me CRUISE CS Swing Date Retur Dele VISITS Visit Order Passenger Cach PORT BOOKING Price Satisfaction de Portre Country Dacking for PASSENGER Pember Name Tinture, Mike Nam, laste Street Address State, Postal Code Country

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions