Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

art 1:Primary Keys / Foreign Keys / Default Bring up your previous 2 assignments with the SQL code: 1.Write the statements to remove (drop) the

art 1:Primary Keys / Foreign Keys / Default Bring up your previous 2 assignments with the SQL code: 1.Write the statements to remove (drop) the previous tables: Booking and Guest. 2.Write new CREATE TABLE statements to create Booking and Guest, but this time alsoinclude the below (Note: modify the 2 statements from the SQL Basics assignment): a.A primary key for each of the tables. Hint: One of them is a compositekey! b.A default price in table Booking should be set to 500. c.Foreign keys where appropriate: guestNo in the Booking table must refer to guestNo in the Guest table. Note: When running multiple sql statements you need semicolons (;) separatingthem. Otherwise run them one at a time. 3.Rerun your insert statements (from the previous 2 weeks assignments) to insert the rows you did before in the tables. Did they work (yes or no)? If not, explain what happened and fix your errors (paste only the updated inserts below). 4.Primary Keys cannot be NULL. Write the SQL statement to insert a row into the Guest table where the guestNo is NULL. Note: Yes, specify the word NULL instead of a number. 5.Describe what happened. Was there an error? If so, paste it.6.Write the SQL to insert a row into Guest where the guestNo is 101. 7.Describe what happened. What was the error? 8.Write a statement to insert into a new row into Booking for an existing guest and do not specify the price. Note: In the insert specify the columns that you do want to add.9.Check out what value got entered into the price. What happened? Paste the results of a select * from Booking. 10.When you run the same command from #8 again what happens? What error message do you receive? 11.Write a statement to insert a new entry into the Booking table butuse a guestNo that is not currently in the Guest table. 12.What happened? What error did you receive? Part 2:Create another TableSince booking guests was so successful you decide to purchase additional properties to sublet. 1.Please write the correct statement to create the following table, choose a primary key: a. Property with the following fields: i.propertyNo (a unique integer) ii.address iii.city iv.state v.zipcode vi.phone 2.Insert into the above table 3 rows. The first is propertyNo 1 which is the address info for your current place that you have been subletting in the previous assignments (you can use any address of your choosing).Insert 2 more addresses with property numbers 2 and 3, for the two new rooms you purchased.3.Paste the results of select * from Property.

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

More Books

Students also viewed these Databases questions

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago

Question

7. Senior management supports the career system.

Answered: 1 week ago