-2

Good afternoon, How to write sql query to insert below 8 values very simply for mysql?

id name 
5 aaa.jpg
6 bbb.jpg
7 ccc.jpg
8 ddd.jpg
9 eee.jpg
10 fff.jpg
11 ggg.jpg
12 zzz.jpg 

Thank you. :)

KevinSwiss
  • 71
  • 1
  • 3
  • 9

2 Answers2

1

You just use INSERT INTO followed by the table you want to insert it into, then specify the column.

For example:

INSERT INTO Images (id, name)
VALUES (1, 'aaa.jpg');

or for inserting multiple values at once:

INSERT INTO Images (id, name)
VALUES (5, 'aaa.jpg'), (6, 'bbb.jpg'), (7, ccc.jpg);

And so on and so forth, you get the idea.

Hope this helps!

zoecarver
  • 5,523
  • 2
  • 26
  • 56
0

You can use comma separated groups for multiple INSERTs, e.g.:

INSERT INTO table VALUES (5, 'aaa.jpg'), (6, 'bbb.jpg');
Darshan Mehta
  • 30,102
  • 11
  • 68
  • 102