RelationalDBDesign
SiteMap
Business Rules
Cursors Views
Database Creation
SQL Monitoring
Database Web Apps
Data Manipulation
Access Features
Tables Queries
CRUD Statements
«Prev
Next»
Queries Cursors Views
SQL-Query Basics
Executing Queries
Batch Queries
System Catalogs
Writing Logic Queries
Dynamic SQL Statements
SQL Server Basics
Selecting Data
Data Overview
Retrieving Data Multiple Tables
Multiple Table Retrieval
Alternate Queries Aliases
Construct Union Queries
Additional Keywords Queries
Define Aggregate Queries
Aggregated Data Queries
Describe Write Subqueries
Using Subqueries - Exercise
Selecting Data Conclusion
Advanced Queries
Inserting Transact SQL Data
Updating Transact-SQL Data
Deleting Data
SQL Statement Punctuation
Insert Values from other Table
Update Values from other Table
Different Datatypes
Subquery Statements
Indexing Query Strategies
Full Text Searching
Full Text Searching
Full Text Searching Components
Defining Full Text Indexes
Implement Full Text Search
Full Text Searching
Inserting Data from values in 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.
Instructions
Consider the Department table that looks like this:
DepartmentID
Description
ManagerID
1
Accounting
302
2
Human Relations
342
3
Information Systems
501
4
Legal
106
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.