Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"…

Write MySQL queries for the following questions (screenshots show correct results): The database is called “Rentals” You can use any name for a table example.

Returns all guests with reservations

Don't use plagiarized sources. Get Your Custom Essay on
Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"…
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

guestid guest istname Tom 3 225 Kelly 216 215 11 212 13 229 Paul 15 221 Anny 17 210 19 228 Skolnik Crown Point 512 513 515 Tinley Park 531 Crown Point Crown Point 540 windsor 541 startdate 201306.1200.00200,000 201306-19 00:00:00.000 2013-03-1100:00:00.000 2013-03-25 00:00:00.000 2013051200.0000.000 201305 22 00:00:00.000 2013-05-01 00:00:00.000 2013-05-15 00:00:00.000 2013-08-2000:00.00.000 201308 27 00:00:00.000 20130404 00:00.00.000 2013-0411 0000:00,000 2013-07.2000:00:00.000 2013-0727 00:00:00.000 20130908 00:00.00.000 20130922 00:00:00,000 2013-08-10 00:00:00.000 2013-08-17 00:00:00.000 2013064030000200.000 201306-10 00:00:00,000 2013-06-22 00:00:00.000 2013-07-06 00:00:00.000 2013-07-11 00:00.00.000 2013-07-18 00:00:00.000 201308-05 00.00.00.000 201308-12 00:00:00.000 2013-11-1600:00:00.000 2013-11-23 00:00:00.000 201309-1000.00.00.000 20130917 00:00:00,000 2013-02-20 00:00:00.000 2013-02-27 00:00:00.000 201308-04 00:00.00.000 2013-08-11 00:00:00.000 2014-04-10 00.00.00.000 2014-04-17 00:00:00.000 201305-20 00:00:00.000 201305-27000000.000

Returns all distinct guests with reservations

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 1

Returns guesid, FirstName, Lastname, Reservationid, propertyname

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 2

Returns all guests without reservations

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 3

Properties without reservations

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 4

Using a subquery return all reservations that have more than the average number of people

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 5

Now add the the firstname and lastname to the previous query

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 6

Using a subquery return all guests with reservations

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 7

Create stored proc that returns all personnel and then execute it

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 8

Create view that displays all properties with reservations

Answered! Write MySQL queries for the following questions (screenshots show correct results): The database is called "Rentals"... 9

Expert Answer

Assuming Below tables:

1. guests Table:
guestId, guestFirstName, guestLastName, city
2. reservations Table:
reservationId, startDate, endDate, propertyId
3. property table
propertyId, propertyName

Returns all guests with reservations:

select g.guestId, g.guestFirstName, g.guestLastName, g.city, r.reservationId, r.startDate, r.endDate
from Rentals.guests g, Rentals.reservations r
where
g.guestId = r.guestId

Returns all distinct guests with reservations:

select .guestId, g.guestFirstName, g.guestLastName, g.city
from Rentals.guests g
where g.guestId in (select distinct r.guestId from Rentals.reservations r)

Returns guesid, FirstName, Lastname, Reservationid, propertyname

select g.guestId, g.guestFirstName, g.guestLastName, g.city, r.reservationId, p.propertyName
from Rentals.guests g, Rentals.reservations r, Rentals.property p
where
g.guestId = r.guestId and
r.propertyId = p.propertyId

Returns all guests without reservations

select .guestId, g.guestFirstName, g.guestLastName
from Rentals.guests g
where g.guestId not in (select distinct r.guestId from Rentals.reservations r)

Properties without reservations

select p.propertyName
from Rentals.property p
where
p.propertyId not in (select distinct r.propertyId from Rentals.reservations r)

Hey, I am answering to your first 5 queries. I request you to please post other remaining sub parts in a seperate question, as due to time constraints, it is not possible to answer all of your subparts.

Still stressed from student homework?
Get quality assistance from academic writers!