Error Code: 1136. Column count doesn't match value count at row 1
roll_no INT PRIMARY KEY NOT NULL unique,
name CHAR(15) NOT NULL,
class integer(3),
section CHAR(1),
sibling boolean default false);
insert into school
values(1,'ramesh',12,'D');
Error Code: 1136. Column count doesn't match value count at row 1
roll_no INT PRIMARY KEY NOT NULL unique,
name CHAR(15) NOT NULL,
class integer(3),
section CHAR(1),
sibling boolean default false);
insert into school
values(1,'ramesh',12,'D');
If you don't provide values for all the columns, you need to explicitly state what columns the values refer to:
insert into school(roll_no, name, class, section)
values(1, 'ramesh', 12, 'D');
You didn't specify the column names in the insert, and therefore MySQL is expecting data for all columns. Qualify your target column names, and the insert should work:
INSERT INTO school (roll_no, name, class, section)
VALUES
(1, 'ramesh', 12, 'D');
Best practice for SQL inserts is to always list out the target columns for the insert. One reason for this is that, if you don't, an insert statement could break if either a) the number of columns changes, or b) the order of columns in the table changes.