Linards Berzins
Linards Berzins

Reputation: 83

Why does this MySQL query give "error 1136" when inserting values into table

Query:

INSERT INTO Customer2
VALUES (1, 'Mrs','Jill','Hill','2 Step St','Hillington','Uxbridge',
        'Middx''UB10 8XY','020    8999 684') ;

Upvotes: 0

Views: 14368

Answers (2)

codaddict
codaddict

Reputation: 454920

You are missing a comma between

'Middx''UB10 8XY'
       ^

When MySql finds two strings separated by nothing or whitespace it concatenates them.
This decreases the number of values in your values list by 1 resulting in 1136 error.

You can see a demo here.

Upvotes: 6

Eton B.
Eton B.

Reputation: 6281

From the little details you gave, this is how that query should look like:

INSERT INTO Customer2 VALUES (1, 'Mrs','Jill','Hill','2 Step St','Hillington','Uxbridge','Middx','UB10 8XY','020 8999 684') ;

You're missing a comma between Middx and UB10

Upvotes: 8

Related Questions