SQLConfiguration SQLConfiguration

CRUD Statements  «Prev  Next»

Deleting data from values in another table - Exercise

Create a DELETE statement using values from another table

Objective: Practice creating a DELETE 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 DELETE statement as described in the instructions.


Using the course project as an example, the Timesheets table looks like this:
EmployeeID ClientID TaskID WeekEndingDate Hours
1 17 101 6/1/99 30
1 17 102 6/8/99 50
2 3 101 6/15/99 40
3 32 103 6/1/99 45
3 32 103 6/8/99 35

The Tasks table looks like this:
TaskID Description Chargeable
101 Vacation 0
102 General 1
103 Programming 1
The task is to delete all employees from the Timesheets table for tasks that are not chargeable, as listed in the Tasks table. Construct a DELETE statement that uses both tables to delete the employee from the Timesheets table, as described above.

Submitting the exercise

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