INSERT INTO SELECT

SQL INSERT INTO SELECT Keyword

The INSERT INTO SELECT statement copies data from one table and inserts it into another. This is useful when transferring data between tables with similar structures.

Tutorials dojo strip

SQL INSERT INTO SELECT Syntax

SQL

SQL INSERT INTO SELECT Copy Names from Students to Doctors Example

This query copies names from the Students table into the Doctors table, filling only the first and last name columns. Other fields will be NULL.

SQL

SQL INSERT INTO SELECT Copy Doctors into Patients Table Example

This query inserts rows from the Doctors table into the Patients table, providing fixed values for columns that require non-null data (like dob and gender):

SQL

SQL INSERT INTO SELECT Labs

Tutorials dojo strip