59.0k views
2 votes
12. List the number and name of each customer that either lives in the state of New Jersey(NJ), or that currently has a reservation, or both.13. List the number and name of each customer that lives in the state of New Jersey (NJ) andthat currently has a reservation.14. Find the trip ID and trip name for each trip whose maximum group size is greater than themaximum group size of every trip that has the type Hiking.15. Find the trip ID and trip name for each trip whose maximum group size is greater than themaximum group size of at least one trip that has the type Biking.16. Display the trip ID, trip name, and reservation ID for all trips. All trips should be included inthe result. For those trips that currently do not have reservations, the reservation IDshould be left blank. Order the results by trip ID.

1 Answer

6 votes

Answer:

Check the explanation

Step-by-step explanation:

12.

(SELECT CUSTOMER_NUM,LAST_NAME,FIRST_NAME FROM CUSTOMER WHERE STATE = 'NJ' ) UNION (SELECT CUSTOMER_NUM,LAST_NAME,FIRST_NAME FROM CUSTOMER C INNER JOIN RESERVATION R ON C.CUSTOMER_NUM = R.CUSTOMER_NUM);

13.

SELECT CUSTOMER_NUM,LAST_NAME,FIRST_NAME FROM CUSTOMER C INNER JOIN RESERVATION R ON C.CUSTOMER_NUM = R.CUSTOMER_NUM WHERE C.STATE = 'NJ';

14

SELECT TRIP_ID,TRIP_NAME FROM TRIP WHERE MAX_GRP_SIZE > ( SELECT MAX(MAX_GRP_SIZE) FROM TRIP WHERE TYPE = 'Hiking');

15.

SELECT TRIP_ID,TRIP_NAME FROM TRIP WHERE MAX_GRP_SIZE > ( SELECT MIN(MAX_GRP_SIZE) FROM TRIP WHERE TYPE = 'Biking');

16

SELECT T.TRIP_ID,T.TRIP_NAME, R.RESERVATION_ID FROM TRIP T RIGHT INNER JOIN RESERVATION R ON T.TRIP_ID = R.TRIP_ID ORDER BY T.TRIP_ID;

User Anquegi
by
4.9k points