SQL INSERT

The INSERT statement is used to add new records into a table.

๐Ÿ”น Basic Syntax

-- Insert values into all columns (must match order)
INSERT INTO employees 
VALUES (101, 'John Doe', 'IT', 60000);

-- Insert into specific columns
INSERT INTO employees (employee_id, name, salary)
VALUES (102, 'Jane Smith', 75000);

๐Ÿ”น Insert Multiple Rows (MySQL, PostgreSQL, SQL Server)

INSERT INTO employees (employee_id, name, salary)
VALUES 
  (103, 'Alice', 65000),
  (104, 'Bob', 70000);

๐Ÿ”น Oracle Note (INSERT ALL)

-- Oracle: multi-row insert
INSERT ALL
  INTO employees (employee_id, name, salary) VALUES (105, 'Karan', 67000)
  INTO employees (employee_id, name, salary) VALUES (106, 'Priya', 72000)
SELECT * FROM dual;

๐Ÿง  Quick Recap

FeatureSyntax Example
Insert full rowINSERT INTO table VALUES (...)
Insert with columnsINSERT INTO table (col1, col2) VALUES (...)
Multiple rowsINSERT INTO table (...) VALUES (...), (...)
Oracle multi-insertINSERT ALL ... SELECT * FROM dual;

โœ… Use INSERT to populate your table with fresh data