SQL Select Into

The SELECT INTO statement in SQL is used to create a new table and insert data from an existing table into the new table in a single query.

SQL Select Into Syntax

SELECT column1, column2, ...
INTO new_table
FROM existing_table
WHERE condition;



SQL Select Into Copy Patients Data Into New Table Example

This query selects the patients_id, first_name, last_name, and status from the Patients table where the status is ‘active’.

SELECT patient_id, first_name, last_name, status
INTO ActivePatients
FROM Patients
WHERE status = 'active';




SQL Select Into Visual Diagram




SQL Select Into Labs

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top