#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Step 4
4 min read

INSERT Operations

Add new data to your database tables.

What is INSERT?

INSERT adds new rows to a table. Use it when you want to add new data.

The Syntax

INSERT INTO table_name (columns) VALUES (values);

Before INSERT

Our students table: (see table below)

students table - Before INSERT
idnameagegrade
1Alice20A
2Bob22B
3Charlie21A
3 rows

Insert One Row

INSERT INTO students (id, name, age, grade) VALUES (4, 'David', 23, 'B');

After INSERT: (see after insert table below)

students table - After INSERT (David added)
idnameagegrade
1Alice20A
2Bob22B
3Charlie21A
4David23B
4 rows

New student David added!

Insert Multiple Rows

Add many rows at once:

INSERT INTO students (id, name, age, grade) VALUES (5, 'Emma', 20, 'A'), (6, 'Frank', 22, 'C');

How INSERT Works (Step by Step)

Step 1: Write INSERT INTO

Step 2: Specify table name

Step 3: List columns in ( )

Step 4: Write VALUES

Step 5: Add values in ( ) matching the columns

INSERT INTO students -- Step 1 & 2 (id, name, age) -- Step 3 VALUES (4, 'David', 23); -- Step 4 & 5

Quick Reference

  • INSERT INTO table (cols) VALUES (vals) - Add one row
  • VALUES (row1), (row2) - Add multiple rows
  • Column order must match value order

Tip: Always list column names - it's clearer and safer!

Try INSERT

Edit the values and click Run to add a new row

Current Table: students
idnameagegrade
1Alice20A
2Bob22B
3Charlie21A
3 rows
SQL Editor
Loading...

Finished this topic?

Mark it complete to track your progress and maintain your streak!

SkillsetMaster - AI, Web Development & Data Analytics Courses