Paul Anthony Morillo
Paul Anthony Morillo

Reputation: 133

SQL Insert Query, Column count doesnt match value count

I'm creating a database using mysql and im trying to insert values into it but its not working. Can someone show me the error of my ways, its probably a really small common error I'm making.

create table cars (
Car_VIN CHAR(17),
Car_model CHAR(20),
Car_year int,
Car_make char(20),
Current_Mileage int,
Car_price int,
Car_bodytype char(20),
Car_color char(20),
Car_trim char(20),
Car_additionaloptions char(200),
primary key (Car_VIN));

insert into cars values ('JF1SF65611H734114','Model 3',2020,'Tesla',37990,'Sedan','White','Base','None');

Error: ERROR 1136 (21S01): Column count doesn't match value count at row 1

Upvotes: 1

Views: 105

Answers (1)

Fahmi
Fahmi

Reputation: 37473

You've missed the Car_price value.

I've input 2000000 for your reference:

create table cars (
       Car_VIN CHAR(17),
       Car_model CHAR(20),
       Car_year int,
       Car_make char(20),
       Current_Mileage int,
       Car_price int,
       Car_bodytype char(20),
       Car_color char(20),
       Car_trim char(20),
       Car_additionaloptions char(200),
       primary key (Car_VIN));
insert into cars values (
'JF1SF65611H734114','Model 3',2020,'Tesla',37990,
2000000,'Sedan','White','Base','None');

Upvotes: 3

Related Questions