SQL
Insert Multiple Rows in a Single SQL Statement
Efficiently add multiple new records to a database table using a single INSERT statement with multiple VALUES clauses for better performance.
INSERT INTO products (product_name, category, price, stock_quantity)
VALUES
('Laptop Pro', 'Electronics', 1200.00, 50),
('Mechanical Keyboard', 'Accessories', 85.50, 200),
('External SSD 1TB', 'Storage', 150.00, 100);
How it works: This snippet demonstrates how to insert multiple new rows into a table using a single `INSERT` statement. Instead of executing separate `INSERT` statements for each row, providing multiple sets of `VALUES` significantly improves efficiency and performance, especially when adding a large number of records.