Can you please write SQL following queries based on below ER diagram ( Assume yo
ID: 3743076 • Letter: C
Question
Can you please write SQL following queries based on below ER diagram (Assume you have already created DB tables)?
Assignment 1 Sample Solution ER model QRentals database system LOCATION Location Name Address Pick upDrop off CAR INSURANCE RENTAL Full Name BirthDate Address/Phone StartDate End Date [Cost] Make&Model NumOfSeats ManufacturedYear Carlmage PolicyN InsurerName Premium StartDate ExpiryDate CustomerType Associated Belong to Cust Type" BOOKING VEHICLECATEGORY CategoryID CategoryName Daily hire rate Description CORPORATE INDVIDUAL OrgnizationName ABN Personal Life Insured Travel special deal Process EMPLOYEE FullName BirthDate Phone SkillLevel AnnualSalaryExplanation / Answer
If you have any doubts, please give me comment...
1)
SELECT RegoNo, make, model, NumOfSeats, ManufacturedYear, CategoryID, CategoryName, DailyHireDate
FROM CAR C, VEHICLE_CATEGORY V
WHERE C.CategoryID = V.CategoryID;
2)
SELECT EmployeeID, FullName, LocationName, COUNT(*) AS no_of_bookings
FROM EMPLOYEE E, LOCATION L
WHERE E.LocationID = L.LocationID
GROUP BY EmployeeID, FullName, LocationName
ORDER BY no_of_bookings DESC;
3)
SELECT FullName, Phone, BookingDate
FROM CUSTOMER C, BOOKING B
WHERE C.CustomerID = B.CustomerID;
4)
SELECT FullName, RegoNo, make, model, StartDate, EndDate, Cost
FROM CUSTOMER C, CAR CR, RENTAL R
WHERE C.CustomerID = R.CustomerID AND CR.RentalID = R.RentalID;
5)
SELECT FullName, P.LocationName, D.LocationName, StartDate, EndDate, Cost
FROM CUSTOMER C, RENTAL R, LOCATION P, LOCATION D
WHERE C.CustomerID = R.CustomerID AND R.PickUpLocationID = P.LocationID AND R.DropOffLocationID = D.LocationID;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.