Skip to content
Advertisement

Insert a line with different values

CREATE TABLE `playersrb` (
`position` numeric(24) DEFAULT NULL,
`piece_color` enum('B','R') NOT NULL,
`id` numeric(30) DEFAULT NULL,
`last_action` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
)

How to insert a line ? position the number 12 piece_color the R id 0 and 1 . I want to have two numbers here

I did

INSERT INTO `playersrb` VALUES('12','R','01');

The returned error was:

00:20:16    INSERT INTO `playersrb` VALUES('12','R','01')   Error Code: 1136. Column count doesn't match value count at row 1   0.00062 sec

Advertisement

Answer

You need to specify the columns to insert if you would like to use VALUES. In your case, it would be something like this:

INSERT INTO `playersrb` (`position`, `piece_color`, `id`) VALUES ('12','R','01');
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement