🔧 Quick Syntax:
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);This is how you tell SQL:
“Yo, here’s the table. I’m giving you these values. Save them like this.”
🧾 Let’s say you have a table called friends
It has the following structure:
| Column | Data Type | Notes | 
|---|---|---|
| id | INT | Auto-increment, Primary Key | 
| name | VARCHAR(50) | Required | 
| age | INT | Optional | 
| phone | VARCHAR(15) | Optional | 
✅ Adding One Friend
INSERT INTO friends (name, age, phone)
VALUES ('Ravi', 25, '9876543210');💡 Output:
Query OK, 1 row affectedThe data has been added to your table. SQL automatically gives id = 1 since it’s set to auto-increment.
➕ Adding Another Friend
INSERT INTO friends (name, age, phone)
VALUES ('Simran', 28, '9123456789');💡 Output:
Query OK, 1 row affectedTable Now Looks Like:
| id | name | age | phone | 
|---|---|---|---|
| 1 | Ravi | 25 | 9876543210 | 
| 2 | Simran | 28 | 9123456789 | 
❌ What Happens If You Miss a Required Column?
INSERT INTO friends (age, phone)
VALUES (30, '9999999999');⚠️ Output:
ERROR 1364 (HY000): Field 'name' doesn't have a default valueWhy? The name column was marked NOT NULL, so SQL won’t allow it to be empty.
📦 Adding Multiple Friends at Once
INSERT INTO friends (name, age, phone)
VALUES 
  ('Aman', 22, '8888888888'),
  ('Neha', 26, '7777777777'),
  ('Karan', 24, '6666666666');💡 Output:
Query OK, 3 rows affectedUpdated Table:
| id | name | age | phone | 
|---|---|---|---|
| 1 | Ravi | 25 | 9876543210 | 
| 2 | Simran | 28 | 9123456789 | 
| 3 | Aman | 22 | 8888888888 | 
| 4 | Neha | 26 | 7777777777 | 
| 5 | Karan | 24 | 6666666666 | 
💤 What If You Don’t Know All Values?
INSERT INTO friends (name, age)
VALUES ('Karan', 24);SQL will fill the missing phone column with NULL, since it’s optional.
🧃 Recap
- INSERT INTOlets you add real data into your table
- Always include required columns like NOT NULLones
- Use one row at a time or many rows in one go
- AUTO_INCREMENThandles IDs — you don’t have to set them manually