3
votes

when i was using mysql, i created a simple group and when i was inserting values this happened

1 queries executed, 0 success, 1 errors, 0 warnings

Query: INSERT INTO emp(id, ename,sal,rank) VALUES( 01, 'jacob', 10,000, 'supervisor' )

Error Code: 1136 Column count doesn't match value count at row 1

Execution Time : 0 sec Transfer Time : 0 sec Total Time : 0.008 sec I don't know why this happened but will like to include I am new to SQL, this is my table data:

CREATE TABLE emp(
  id int(11) NOT NULL AUTO_INCREMENT,
  ename varchar(50) DEFAULT NULL,
  sal int(11) DEFAULT NULL,
  rank varchar(50) DEFAULT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

this is what i tried to insert:

INSERT INTO emp(id, ename,sal,rank)
VALUES(01,'jacob',10,000,'supervisor');
SELECT * FROM emp;

i seriously do not know why the code won't work, can anyone help?

1
because you specified 10,000 with a comma, which is interpreted as 2 numbersYann39
rank becomes a reserved word in version 8 - either change it or backtick it. And take the , out of the amount worry about this in the presentation layer.P.Salmon

1 Answers

0
votes

Your column count is 4 only but the comma in the 10,000 makes it 5 that’s why the error says column count doesn’t match