You are on page 1of 6

Session 3 -3

5.How many trips have a type of Hiking or Biking?

SQL Query:
SELECT Count(Trip.TripName) AS CountOfTripName, Trip.Type
FROM Trip
GROUP BY Trip.Type, Trip.Type
HAVING (((Trip.Type)="hiking" Or (Trip.Type)="biking"));

Answer:

10. How many reservations include a trip with a price that is greater than $20 but less than $75?

CustomerNum .ReservationID. 2016. customer last name.CustomerNum = Reservation. and customer first name for all trips that occur in July.FirstName FROM Customer INNER JOIN Reservation ON Customer. SQL query: SELECT Reservation.ReservationID) AS CountOfReservationID FROM Reservation WHERE (((Reservation. Result: 13.LastName.TripPrice) Between 20 And 75)). Customer. Customer. customer number. Customer.SQL query: SELECT Count(Reservation. List the reservation ID.CustomerNum.

TripID = Reservation.00 for all records on which the OtherFees value is $0. Result: 16. Use an update query to change the OtherFees value in the Hiking table to $5.00.* into hiking FROM Trip INNER JOIN Reservation ON Trip. .TripDate) Between #7/1/2016# And #7/31/2016#)). SQL query for creating hiking table: SELECT Reservation.Type)="hiking")).TripID WHERE (((Trip.WHERE (((Reservation.

OtherFees = 5 WHERE hiking.Before Updating: SQL query: UPDATE hiking SET hiking. .OtherFees=0.

TripDate FROM hiking WHERE (((hiking. SQL query: DELETE hiking. . Use a delete query to delete all trips in the Hiking table where the trip date is 6/12/2016.TripDate)=#6/12/2016#)).17.

Result:After deleting .