INSERT INTO QueryThe INSERT INTO statement is used to add new rows (records) to a table in MySQL.
INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
Suppose we have this products table:
CREATE TABLE products ( product_id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), description TEXT, price FLOAT, in_stock BOOLEAN, created_at DATE );
We can insert a new product like this:
INSERT INTO products (name, description, price, in_stock, created_at)
VALUES ('Wireless Mouse', 'Ergonomic wireless mouse', 15.99, TRUE, '2025-05-16');
product_id), you donβt need to insert a value for it.' '.
INSERT INTO products (name, description, price, in_stock, created_at)
VALUES
('Keyboard', 'Mechanical keyboard', 29.99, TRUE, '2025-05-15'),
('USB Cable', '1 meter USB-C cable', 5.49, TRUE, '2025-05-10');
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!