Cleanshot Cleanshot - 6 months ago 10
SQL Question

mysql error code 1054 not sure what it means

I am getting the error code 1054 Unknown column 'interlake' in 'field list'

drop table if exists `Boats`;
create table `Boats` (
`bid` int(11) not null,
`bname` varchar(45) default null,
`color` varchar(15) default null,
primary key (`bid`)
) engine=InnoDB default charset=latin1;

alter table `Boats` disable keys;
insert into `Boats` values
(101,`Interlake`,`blue`),(102,`Interlake`,`red`),(103,`Clipper`,`green`),(104,`Marine`,`red`);
alter table `Boats` enable keys;

Answer

Use quotes instead of back ticks

INSERT INTO `Boats`
(`bid`, `bname`, `color`) 
VALUES  
(101,"Interlake","blue"),
(102,"Interlake","red"),
(103,"Clipper","green"),
(104,"Marine","red");
Comments