Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please help me solving the following asap The INSERT statement is used to insert new records in a table. Write the following insert statements. 1.
please help me solving the following asap
The INSERT statement is used to insert new records in a table. Write the following insert statements. 1. Insert at least 5 rows into the table, Guest, use IDs 101-105. Guest 101 should be George Washington, and 102 Jane Smith. You decide the rest. 2. Insert 5 rows into the table, Booking. You can charge $500 a month rent to each of them. Hint: Format for date is '2023-07-01'. 1. a) Guest 101 would like to use your space from June I, 2023 - June 30, 2023 and August 1, 2023-August 31, 2023 2. b) Guest 102 would like to come July 1, 2023-July 31, 2023 and July 1, 2024-July 31 , 2024. 3. c) Guest 103 would like to come September 1, 2023 - September 30, 2023. Hint: Try inserting one a time until you ger the hang of insert. Then, you can insert multiple rows at one time like in this below example whene the table has 3 columns: (see lecture notes for defails on inserting) INSERT INTO Table-Name VALUES (col-1, col-2, col-3). (col-1, col-2, col-3), ( col-1, col-2, col-3), (col-1, col-2, col-3), (col-1, col-2, col-3) When you are done clicking on the table name will show you the columns in the table. Part 3: Selecting Rows In order to retrieve data from a database table you have to use the SELECT statement. Write each of the below statements: 1. Select all columns from your Guest table using the below format. SELECT column_ name,column_ name FROM table_nome; 2. Paste the results of the statement (you should see all of your data for all of your rows) 3. Now enter SELECT * FROM Booking (* selects all columns!) 4. Paste the results. 5. Write the statement to list ONLY the first and last name of all Guests ordered by the guests' last name. 6. Paste the results of the statement. 7. Write the statement to select all distinct guestNos from the Bookings table, 8. Paste the results of the statement. 9. Write the statement to select the first name from the Guest Table where the last name is Washington. 10. Paste the results of the statement. 11. Oh no! You can't quite remember his last name, was it Washing or Wash or Washington or Washings. Write the statement to select his first name given that it's something LIKE Wash. 12. Paste the results of the statement. 13. Select all details for Guests 101 and 102 I the same statement in the Gunest fable. (Hint: You will need an OR in your where statement) Part 4: Deleting Rows Write statements to delete rows from your table. Guest 103 decides to cancel a reservation. 1. Write the statement to delete only that row from the Booking table. 2. Please verify that s/be is no longer in the table by running the necessary select statement. 4. Paste the results of the stotement. Part 5: Updating Rows Write statements to edit rows in your table. Congratulations! Jane Smith got married and decided to change her last name to Johnson. 1. Write the statement to update that information. 2. Please write a statement to view that your changes took place correctly. 3. Paste the results of the above statement. 4. Write a statement to update two attributes for any other row in any table. You must do this in one statement. 5. Please write a statement to view that your changes took place correctly. 6. Paste the results of the above statement Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started