SQL
Inserting Data from Another Table

You can also insert data into a table from another table using a SELECT statement:


INSERT INTO employees (first_name, last_name, age, department)
SELECT first_name, last_name, age, department
FROM new_employees;

Handling NULL Values

If you want to insert NULL values into specific columns, just use the NULL keyword:


INSERT INTO employees (first_name, last_name, age, department)
VALUES ('Tom', 'Harris', NULL, 'Engineering');

Inserting Default Values

If a column has a default value and you want to insert the default value, you can omit that column from the INSERT statement:


INSERT INTO employees (first_name, last_name, department)
VALUES ('Emily', 'Clark', 'Sales');