0 votes
1 view
in SQL by (22.4k points)

I have a 1-many number of records that need to be entered into a table. What is the best way to do this in a query? Should I just make a loop and insert one record per iteration? Or is there a better way?

1 Answer

0 votes
by (40.3k points)

If you are using the MySQL manual, then use this code:

To include multiple lists of column values, each enclosed within parentheses and separated by commas. Use INSERT statements that use VALUES syntax which can insert multiple rows like this: 

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...