SQL INSERT
The INSERT statement is used to add new records into a table. πΉ Basic Syntax πΉ Insert Multiple Rows (MySQL, PostgreSQL, SQL Server) πΉ Oracle Note (INSERT ALL) π§ Quick Recap Feature Syntax Example Insert full row INSERT INTO table VALUES (...) Insert with columns INSERT INTO table (col1, col2) VALUES (...) Multiple rows 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
Was this helpful?
Thanks for your feedback!