From the course: Advanced SQL for Application Development

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Solution

Solution

(upbeat music) - [Instructor] Okay, the solution to our data migration challenge is as follows. We're going to have one DDL command which is an alter table, which we used to add the column, which is called export code to our product table. We're then going to have 10 insert statements with that new product data that was specified in the challenge itself, and then we're going to need an update statement to set export code to unrestricted for all of the rows where export code is null. So the 10 newly inserted product codes have a value of export code set to restricted, but the other rows in the product table that were already in there before the export code column was added are going to have null values, so we only want to update those with null values and that's why we need to have the where export code is null in that update statement.

Contents