🔍
👶 Kids📝 Blog About Contact 🚀 Get Started Free

SQL – INSERT

Add new rows to a database table using the INSERT INTO statement.

Everything in a database started as an INSERT. When a user signs up on a website, their data is inserted into a users table. When you place an order online, a new row is inserted into the orders table. The INSERT INTO statement is how new data enters a database, and it is one of the four fundamental SQL data-manipulation operations (alongside SELECT, UPDATE, and DELETE).

You can insert a single row at a time, or insert multiple rows in one statement for efficiency. Inserting multiple rows in a single query is dramatically faster than running hundreds of individual inserts — always batch when you can.

Two ways to INSERT

-- With column list (recommended)
INSERT INTO students (name, age, city, score, grade)
VALUES ('Zara Ali', 20, 'Delhi', 88.5, 'A');

-- Multi-row insert
INSERT INTO students (name, age, city, score, grade)
VALUES ('Jake Kim', 23, 'Pune', 76.0, 'B'),
       ('Luna Ray', 21, 'Mumbai', 92.1, 'A');

Try It Yourself — Interactive SQL Editor

Edit the query below and click Run Query ▶ to see live results powered by SQLite running directly in your browser.

SQLite – edit & run
Results
← Click Run Query ▶ to see results

Key Points

  • Always specify column names in INSERT — safer against schema changes
  • Values must match column data types
  • INSERT with SELECT copies rows from another table or query
  • Most databases auto-generate PRIMARY KEY values when omitted

Pro Tip from CodesCompiler: The best way to learn SQL is to break things intentionally — modify the query above, change the WHERE conditions, try different columns. Every error teaches you something the docs cannot.

In the next lesson, we continue exploring SQL’s powerful feature set to build your database mastery.