Snatch any course you want for just \$15! Go to “Courses” and find a course ↓
Introduction
Inserting and updating NULLs
Conditions in UPDATE and DELETE
Using values from another column
Inserting data from a query
13. INSERT INTO ... SELECT
Summary

## Instruction

Very nice! You've been using this syntax to insert data: INSERT INTO ... VALUES. But what if you would like to insert values from another table? SQL provides special syntax for this:

INSERT INTO student_history(id, first_name, last_name)
SELECT id, first_name, last_name
FROM student;


Instead of a VALUES clause with a list of values, we use a SELECT query. In this way, the id, first_name, and last_name values for all students were put into the student_history table—in one INSERT query. It’s a very convenient solution for copying data from one place to another.

## Exercise

The university wants to have a list of all oral exams in which students got more than 20 points. They want it in a new table, report_good_oral_exams.

Use the id, student_id, and subject columns from the exam table to put data into exam_id, student_id, and subject columns in the report_good_oral_exams table.