SQL · Writing data

insert from select

Copies rows from another query into a table.

Syntax
insert into t (cols) select …

Example

Open in the lab

More in this group

delete insert insert returning merge truncate update update from upsert

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course