For this example, we will use the table(users).
id | first_name | last_name | address |
1 | Aman | Kumar | Delhi |
Insert single record
INSERT INTO table_name(field1_name, field2_name)VALUES(value1, value2);
Example
INSERT INTO users(first_name, last_name, address)VALUES("Ram", "Singh", "Delhi");
id | first_name | last_name | address |
1 | Aman | Kumar | Delhi |
2 | Ram | Singh | Delhi |
Insert multiple records
INSERT INTO table_name(field1_name, field2_name)VALUES(value1, value2), (value1, value2), (value1, value2);
Example
INSERT INTO users(first_name, last_name, address)
VALUES("Krishna", "Singh", "Delhi"),
("Mohit", "Singh", "Delhi"),
("Swayam", "Singh", "Delhi"),
("Shailly", "Singh", "Delhi");
id | first_name | last_name | address |
1 | Aman | Singh | Delhi |
2 | Ram | Singh | Delhi |
3 | Krishna | Singh | Delhi |
4 | Mohit | Singh | Delhi |
5 | Swayam | Singh | Delhi |
6 | Shailly | Singh | Delhi |