Column count does not match the value count on row 1

Asked

Viewed 1,820 times

1

I need guidance on how to identify the error in this received message after importing text file:

1136 - Column count does not match the value count on row 1

The table columns are 10 and the data entered is 10. SEE:

INSERT INTO `cgts` (`id`, `nome`, `cidade`, `estado`, `email`, `tipo`, `titulo`, `mensagem`, `data`, `ver`) VALUES
(NULL, 'Álvaro', 

'Bau', '', '222.32.232.223', 'Curioso', 'Cultura inutil:-`, `Turritopsis é biologicamente imortal. ', '2017-04-05', '1');

2 answers

2

You have one more column in your column listing than the values one. According to the query you posted, you have the following value list:

id -> NULL
nome -> 'Álvaro'
cidade -> 'Bau'
estado -> ''
email -> '222.32.232.223'
tipo -> 'Curioso'
titulo -> 'Cultura inutil:-`, `Turritopsis é biologicamente imortal. '
mensagem -> '2017-04-05'
ver -> '1'

I believe you have a mistake in the dice titulo. Probably his intention was to put a quotation mark after "Useless Culture:-", which is missing. There it is as follows:

id -> NULL
nome -> 'Álvaro'
cidade -> 'Bau'
estado -> ''
email -> '222.32.232.223'
tipo -> 'Curioso'
titulo -> 'Cultura inutil:-`' 
mensagem -> '`Turritopsis é biologicamente imortal. '
data -> '2017-04-05'
ver -> '1'

0

Check that your id is AUTO_INCREMENT, then remove the id from the Insert.

INSERT INTO `cgts` (`nome`, `cidade`, `estado`, `email`, `tipo`, `titulo`, `mensagem`, `data`, `ver`) VALUES ('Álvaro', 'Bau', '', '222.32.232.223', 'Curioso', 'Cultura inutil:', 'Turritopsis é biologicamente imortal. ', '2017-04-05', '1');
  • Welcome to Stack Overflow! It’s nice that you want to help, but you used the response field to comment. You can post comments when you have a little more reputation points. Please use the answer field only to post a solution to the problem the question deals with.

  • Jessika, thanks for the tip but, after making these changes by you indicated the answer I got was the same ---> Mysql messages : Documentation #1136 - Column count does not match the value count in row 1

  • Is there any way you can put here the sql you used to create the table? To see if I can help you.

  • Name Type Grouping (Collation) Attributes Default Null 1 idIn(5) None AUTO_INCREMENT 2 name varchar(50) latin1_swedish_ci No 3 varchar city(50) latin1_swedish_ci No 4 char state(2) latin1_swedish_ci No 5 email varchar(50) latin1_swedish_ci No 6 varchar type(8) latin1_swedish_ci No 7 varchar title(100) latin1_swedish_ci No 8 message text latin1_swedish_ci No None 9 data date No 0000-00-00 10 ver char(1) latin1_swedish_ci Yes 1

  • You put in the 'id' Insert, but by what you sent me the column calls 'idPrimary'.

  • Sorry, it’s just id, I made a mess.

  • I created the table in mysql: CREATE TABLE cgts ( id INT NOT NULL AUTO_INCREMENT , nome VARCHAR(50) NOT NULL , cidade VARCHAR(50) NOT NULL , estado CHAR(2) NOT NULL , email VARCHAR(50) NOT NULL , tipo VARCHAR(8) NOT NULL , titulo VARCHAR(100) NOT NULL , mensagem TEXT NOT NULL , data DATE NOT NULL , ver CHAR(1) NULL , PRIMARY KEY (id)) ENGINE = Innodb; and put the Insert I sent you up there and it worked.

  • I’ll check again. Tks

  • Okay Jessika, problem solved. Thank you.

Show 4 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.