SQLConfiguration SQLConfiguration

CRUD Statements  «Prev  Next»

Inserting data from values in a different table - Exercise

Create an INSERT statement using values from another table

Objective:Practice creating an INSERT statement using values from another table.

Exercise scoring

This exercise is worth a total of 10 points. You will receive up to 10 points for accurately creating the INSERT statement as described in the instructions.


Consider the Department table that looks like this:

DepartmentID Description ManagerID
2Human Relations342
3Information Systems501

Consider the DepartmentHistory table that looks like this (with no data in it):

DepartmentID ManagerID HistoryDate

Construct an INSERT statement that uses the DepartmentID value of 3 in the Department table and inserts into the DepartmentHistory table the DepartmentID, ManagerID, and HistoryDate columns. Use the GETDATE() function to insert the current date into the HistoryDate column.

Submitting the exercise

Type or paste your Transact-SQL statement into the text box below, then Submit to submit them and view a results page.