Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using VIEW functions to CREAT VIEW reservation_id last_name first_name room_number check_in_date check_out_date 6 Gamgee Sam 102 2018-04-06 2018-04-08 7 Katniss Everdeen 201 2018-04-10 2018-04-12 3

Using VIEW functions to CREAT VIEW

reservation_id last_name first_name room_number check_in_date check_out_date
6 Gamgee Sam 102 2018-04-06 2018-04-08
7 Katniss Everdeen 201 2018-04-10 2018-04-12
3 Granger Hermoine 201 2018-05-01 2018-05-08
4 Weasley Ron 201 2018-05-01 2018-05-08
1 Potter Harry 301 2018-05-01 2018-05-08
2 Potter Harry 201 2018-09-10

2018-09-13

1. Create a view that lists the guests who have reservations that begin on a Monday, Tuesday, Wednesday, or Thursday. Include the following columns:

a concatenated version of the guests name (e.g., Granger, Hermoine)

the check-in date, formatted as mm/dd/yyyy (e.g., 05/01/2018)

the day of the week spelled out fully (e.g., Monday)

Use aliases to provide descriptive and user-friendly column names. Sort the results by day of week, last name, first name.

Hint: when sorting by day of week you dont want to sort alphabetically; instead you want to sort by the numeric position of the day of week, using DATE_FORMAT code %w (instead of %W).

2. Create a view that lists guests whose reservation is longer than 3 days. Include the following columsn:

a concatenated version of the guests name (e.g., Granger, Hermoine)

the check-in date, formatted as mm/dd/yyyy (e.g., 05/01/2018)

the check-out date, formatted as mm/dd/yyyy (e.g., 05/05/2018)

the number of days for the reservation

Use aliases to provide descriptive and user-friendly column names. Sort the results by descending reservation length, then by last name, first name.

DATA BELOW

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago