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

## Instruction

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

## Exercise

We've created another table called project_worktime. It has the following columns: project_id and avg_worktime.

Your task is to insert the average number of hours spent on each project into the new table project_worktime. (Use the table allocation.) Each time, insert the project_id and the average hours_spent.

Important: Do not insert any data for project_id = 1.

### Stuck? Here's a hint!

You'll need two CTEs:

1. One to get the sum of hours spent by a given user on a given project, and
2. One to get the average sum of hours per project, based on the result of the first CTE.