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
| Feature | Syntax Example |
|---|---|
| Insert full row | INSERT INTO table VALUES (...) |
| Insert with columns | INSERT INTO table (col1, col2) VALUES (...) |
| Multiple rows | INSERT INTO table (...) VALUES (...), (...) |
| Oracle multi-insert | INSERT ALL ... SELECT * FROM dual; |
✅ Use INSERT to populate your table with fresh data
