Database Tutorial

Course Tutorial Site

Site Admin

Description

without comments

Lab #8: Insert data from queries

Learn how to use an INSERT statement with a query of other data and an embedded sequence value. Reinforce how to alter a table’s column to add a NOT NULL constraint, update a column with a correlated UPDATE statement, learn how to use a correlated UPDATE statement to set an initial value in a newly added column.

Lab Description

You learn how to match the SELECT-list sequence of values to the column-list of the price table. You re-enforce how to change a null allowed column into a NOT NULL allowed column by adding a column constraint. You re-enforce a skill learned in the prior lab by using a correlated UPDATE statement to populate a newly added column with correct values.

The lab has four parts, which you find after clicking on the Lab Instructions link. The steps are:

  • Step 1: Write an INSERT statement that uses a modified form of the SELECT statement that you developed in Lab #7.
  • Step 2: Change a nullable price_type column in the price table to a mandatory column.
  • Step 3: Use a correlated UPDATE statement to populate the correct values for a newly added column and master how to use the BETWEEN operator.
  • Step 4: Change a nullable rental_item_price column in the rental_item table to a mandatory column.

Written by michaelmclaughlin

August 13th, 2018 at 11:32 am

Posted in