INSERT — Adding New Rows
7 min read
Inserting Data with INSERT INTO
INSERT INTO adds one or more new rows to a table. You must specify the table name, optionally list the columns you are providing values for, and then supply the values.
sql
-- Insert a single student (all columns)
INSERT INTO students (id, name, email, city, age)
VALUES (1, 'Aditi Sharma', 'aditi@example.com', 'Mumbai', 22);
-- Insert with some columns omitted (they receive defaults or NULL)
INSERT INTO students (id, name, email)
VALUES (2, 'Rohan Verma', 'rohan@example.com');
-- Insert multiple rows in one statement
INSERT INTO courses (id, title, category, price)
VALUES
(1, 'SQL Fundamentals', 'Databases', 999),
(2, 'Python for Data', 'Programming', 1499),
(3, 'Web Dev Bootcamp', 'Web', 1999);Always list column names explicitly in INSERT statements. If the table schema changes later (columns reordered or added), positional inserts silently put values in the wrong columns.
Ready to test yourself?
Practice SQL— quiz & coding exercises