MySQL + SQL · Lesson 43

INSERT Multiple Rows in MySQL

Insert Many Rows at Once

INSERT INTO students (roll_no, name, marks) VALUES
(1, 'Aman', 88),
(2, 'Riya', 91),
(3, 'Karan', 76);
3 rows inserted with one statement — faster than three separate INSERTs.

INSERT ... SELECT

Copy rows from one table into another:

INSERT INTO toppers (name, marks)
SELECT name, marks FROM students WHERE marks >= 90;

Summary

  • List multiple value groups separated by commas for bulk insert.
  • INSERT ... SELECT copies matching rows from another table.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

WhatsApp