Content
INSERT INTO adds new records to a table. Learn the different ways to insert data into your database.
Basic INSERT Syntax
INSERT INTO table_name (column1, column2) VALUES (value1, value2);
Insert Single Row
INSERT INTO customers (name, email, country)
VALUES ('John Doe', 'john@example.com', 'USA');
Insert Multiple Rows
INSERT INTO products (name, price, category) VALUES
('Product A', 29.99, 'Electronics'),
('Product B', 49.99, 'Electronics'),
('Product C', 19.99, 'Books');
Insert with SELECT
INSERT INTO archived_orders
SELECT * FROM orders WHERE order_date < '2025-01-01';
Insert with Default Values
INSERT INTO users (username, email)
VALUES ('newuser', 'new@example.com');
-- Other columns use default values
Generate INSERT Statements
AI2sql can generate INSERT statements from your data descriptions.
