IN DESPERATE NEED FOR HELP. SQL DEVELOPEMENT. CAN PAY FOR THIS TO BE DONE. My fa
ID: 3707443 • Letter: I
Question
IN DESPERATE NEED FOR HELP. SQL DEVELOPEMENT. CAN PAY FOR THIS TO BE DONE. My father passed away last week and I just got backt to town, and need to hand this in. I apologize for it being so big.
Task
SQL FILE LINK: https://www.dropbox.com/s/ks157r8vj1yr1fr/Assignment%204%20template.sql?dl=0
1. Create the following tables using the SQL CREATE commands. Be sure to include in the CREATE statement not only the definitions of the columns (giving each a name, and specifying the data type for each), but also the definition of the primary keys and foreign keys as well. Create CHECK constraints to enforce the domain constraints indicated. The columns have the following data types:
SHIP. Primary key: {Ship_Name}
CRUISE. Primary key: {Cruise_ID}
RESERVATION. Primary key: {Cruise_ID, Pass_ID} <-- NOTE!!!!
PASSENGER. Primary key: {Pass_ID}
2. Insert the data shown into the tables. You should use one INSERT command for each row of data. (In Oracle, when inserting currency values, don't try to insert the '$' or ',' marks.)
SHIP
CRUISE Note: Use an Oracle sequence to insert the Cruise_ID. Call the sequence cruise_id_sq .
RESERVATION
PASSENGER
3. List the name, size, passenger capacity, and crew capacity of each ship.
4. List the names and registry of all ships with a “Contemporary” lifestyle.
5. List the Cruise ID, the departure date, and ship name for all cruises departing from Miami.
6. List the Cruise ID, departure date, and departure city of all cruises longer than 5 days in duration.
7. List the name and registry of all ships used in a cruise that departs from Miami. (Use the IN + subquery construct.)
8. List the name of all passengers with a reservation on a cruise that departs from Miami. (Use the IN + subquery construct.)
9. List the name of all passengers who have requested a Vegetarian diet on a cruise. Include the name of the ship in query output. (Do a join.)
10. List the names of all passengers with a reservation on a cruise that departs from Miami on 25-May-15. Include the name of the ship in the query output. (Do a join.)
11. List the names of all passengers with a reservation on a cruise on a ship registered in Liberia.
12. List all ship names. For those ships used on a cruise, include the cruise departure city, departure date, and duration.
13. List the Cruise ID, ship name, departure date, and departure city for all cruises departing in June, 2015. (use BETWEEN)
14. List the total number of ships registered in Liberia.
15. List, for each ship, the total number of cruises using that ship.
16. List the total balance due for all reservations. (Result should have a single row).
17. For each cruise, list the cruise ID, the ship name, the departure date, the departure city, and the total number of passengers on that cruise.
18. List the same information as in #17, but show only those cruises with fewer than 3 reservations.
19. List the ship name, size, and service entry date of the largest ship (greatest size). The query should return one row of data. You may not provide any specific values in the WHERE clause (e.g., 'WHERE ship_size = 142000' is not permitted.)
20. Passenger 48596 has paid the remaining balance on his reservation on cruise #5. Make the appropriate change to the database.
21. Cruise #1 has been cancelled, due to hurricane danger. Do what is necessary to delete this cruise and the associated reservations from the database. (In a production database, such an event would not cause data to be deleted; rather, the cruise would be marked as cancelled in some way. But this isn’t a production database, and we need to practice deleting data, so…. )
22. Add a constraint to the Ship table to limit the Ship_Lifestyle values to: Contemporary, Premium, Luxury.
23. Create a view that displays the passenger name, telephone number, and balance due for those passengers who have a positive balance due.
24. For each ship, list the departure date and departure city of that ship’s cruise(s) with the longest duration. (There should be one row for each ship that is used for a cruise.)
25. Create an index on the Ship_Name column in the Cruise table.
Column Name Data Type Domain Key information Ship_Name VARCHAR(100) Primary key Ship_Size INTEGER > 0 Ship_Registry VARCHAR(50) possible values are: Norway, Liberia, The Netherlands, Jamaica, Bahamas Ship_ServEntryDate INTEGER Ship_PassCapacity INTEGER Ship_CrewCapacity INTEGER Ship_Lifestyle VARCHAR(40)Explanation / Answer
1)
11
Select P.Pass_name from Passenger P inner join Reservation R on P.Pass_ID = R.Pass_ID inner join Cruise C on R.Cruise_ID in (Select Cr.Cruise_ID from Cruise Cr inner join Ship S where Cr.Ship_name=Cr.Ship_name and S.Ship_Registry = 'Liberia');
12.
Select Ship_Name, Cruise_DeptCity, Cruise_DeptDate, Cruise_Duration from Cruise;
13.
Select Cruise_ID,Ship_Name, Cruise_DeptCity, Cruise_DeptDate from Cruise where Cruise_DeptDate BETWEEN '01-JUN-2015' AND '30-JUN-2015';
14.
select count(Ship_Name) as No_of_ships_liberia from Ship where Ship_Registry='Liberia';
15.
Select Ship_name,Count(Cruise_ID) as No_of_Cruises from Cruise GROUP BY Cruise_ID;
16.
Select Sum(Res_BalanceDue) as Total_Balance_Due from Reservation;
17.
Select C.Cruise_ID,C.Ship_name,C.Cruise_DeptDate,C.Cruise_DeptCity,count(R.Pass_ID) as Total_passengers from Cruise C, Reservation R where C.Cruise_ID=R.Cruise_ID group by R.Cruise_ID;
18.
Select C.Cruise_ID,C.Ship_name,C.Cruise_DeptDate,C.Cruise_DeptCity,count(R.Pass_ID) as Total_passengers from Cruise C, Reservation R where C.Cruise_ID=R.Cruise_ID group by R.Cruise_ID having count(R.Cruise_ID) < 3;
As per chegg rule we have just limit time to answer please ask remaining in another that we can help you
Thank You