Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Quiz
13. INSERT INTO with CTE
Summary

Instruction

Perfect! How about a slightly more complicated example with INSERT INTO?

Exercise

We've created another table called ProjectWorktime. It has the following columns: ProjectId and AvgWorktime.

Your task is to use the table Allocation and insert the average total number of hours spent by employees on each project into the new table ProjectWorktime. Insert the ProjectId and the average HoursSpent. Additionally, do not insert any data for ProjectId = 1.

First, count the total number of hours spent by each employee on each project which ID is not 1. Then, insert into ProjectWorktime table the average total number of hours spent on each project.