I need the SQL statements for these questions:
6. List the reservation IDs for reservations that are for a paddling trip. (Hint: Use a subquery.)
7. What is the longest distance for a biking trip?
8. For each trip in the RESERVATION table that has more than one reservation, group by trip ID and sum the trip price. (Hint: Use the COUNT function and a HAVING clause.)
9. How many current reservations does Colonial Adventure Tours have and what is the total number of persons for all reservations?
10. List the reservation ID and trip ID for all trips that occur in the month of July, 2016. There are multiple ways to create this query.
here are the tables:
Below are the required Queries:
6)
Select R.Reservation_ID
From Reservation R
Where R.Trip_ID IN (Select distinct Trip_ID From Trip Where TYPE =
'Paddling')
7)
Select Max(Distance) From Trip
Where Type = 'Biking'
8)
Select Trip_Id, SUM(Trip_Price)
From Trip Group By Trip_Id HAVING Count(Trip_Id) > 1
9)
How many current reservations does Colonial Adventure Tours
have and what is the total number of persons for all
reservations?
--- What is Colonial Adventure Tours column name in whihc
table.
--- Total number of person in all reservation
SUM(Num_Persons) As TotalNumberOfPerson
From Reservation
10)
Select Reservation_Id, Trip_id From Reservation
Where Trip_Date >= CONVERT(DATETIME, '07/01/2016',101) AND
Trip_Date <= CONVERT(DATETIME, '07/31/2016',101)
I need the SQL statements for these questions: 6. List the reservation IDs for reservations that...
I am working on multi-table queries for my SQL class using a premade database, which I have included screenshots of. I received assistance and was able to complete a good number of the queries but the bolded ones seem absolutely impossible to do?? How do I write a query for the bolded questions?? I've scoured my textbook and notes and cannot get anything I try to successfully produce results. 1. List all current reservations with the trip ID, customer’s first...
Need SQL statement: List the First and Last name of All Customers and whether or not they have a reservation. (Hint: the results should show the customer information even if they don’t have a reservation.) All Access Obje... 0« - Search... Tables Customer PostalCode 03053 01101 Phone - Click to Add 603-555-7563 413-555-3212 860-555-0703 781-555-8423 585-555-5321 401-555-4848 06108 01854 Guide Reservation 14590 02919 03740 Trip Trip Guides Queries Reservation Query 603-555-0456 814-555-5521 16412 A 04963 BE Trip Trip X X...
Partial Question 10 1/2 pts Give the SQL statement to list the trip name and state for each trip that occurs during one of the Fall seasons that is Early Fall, Spring and Late Fall. Sort by State. Use the wildcard for the season. SELECT TripName, State FROM Trip WHERE Season LIKE '%Fall' OR SEA ORDER BY State: Answer 1: LIKE '%Fall' OR SEASON LIKE 'Spring' Answer 2: ORDER BY Partial Question 11 1/2 pts Give the SQL statement to...
USE colonial; CREATE TABLE CUSTOMER (CUSTOMER_NUM CHAR(4) PRIMARY KEY, LAST_NAME CHAR(30) NOT NULL, FIRST_NAME CHAR (30), ADDRESS CHAR(35), CITY CHAR(35), STATE CHAR(2), POSTAL_CODE CHAR(5), PHONE CHAR(12) ); CREATE TABLE RESERVATION (RESERVATION_ID CHAR(7) PRIMARY KEY, TRIP_ID DECIMAL(3,0), TRIP_DATE DATE, NUM_PERSONS DECIMAL(3,0), TRIP_PRICE DECIMAL(6,2), OTHER_FEES DECIMAL(6,2), CUSTOMER_NUM CHAR(4) ); CREATE TABLE TRIP (TRIP_ID DECIMAL(3,0) PRIMARY KEY, TRIP_NAME CHAR(75), START_LOCATION CHAR(50), STATE CHAR(2), DISTANCE DECIMAL(4,0), MAX_GRP_SIZE DECIMAL(4,0), TYPE CHAR(20), SEASON CHAR(20) ); CREATE TABLE TRIP_GUIDES (TRIP_ID DECIMAL(3,0), GUIDE_NUM CHAR(4), PRIMARY KEY (TRIP_ID, GUIDE_NUM)...