Dedan
Dedan

Reputation: 189

mysql insert clause gives #1064 error

I have a mysql table school

id       dob         name      surname
1      03.04.2011     jj
2      14.07.1999     na
..     ............   ..

I have many rows of data in the above table. Now what I want to do is; fill the surname column using an insert clause as follows

INSERT INTO `school` (surname) VALUES
('highvision'),
('oceanof'),
('malindimetho'),
('tahdhibprima'),
('stpatricks'),
...............
('stpatricks');

note: the number of rows I am inserting equals the number of rows in my table

On using the above INSERT statement I get the following error

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line ..

How can I insert the rows?

Upvotes: 0

Views: 41

Answers (1)

weigreen
weigreen

Reputation: 1242

You cannot use INSERT to fill the table.

You can use the following:

UPDATE `school` SET `surname` = 'highvision' WHERE `id` = '1'

Upvotes: 1

Related Questions