This is my table.
create table Property(
p_id int(4) null primary key,
p_address varchar(120) not null,
c_id int(4) not null,
foreign key (c_id) references customer (c_id)
);
insert into Property values
('2001','Elm_House_11_Short_Lane_Hertfordshire_H5_667',’3001’);
insert into Property values
('2002','Jainlight_House_Apple_Lane_Kent_K7_988',’3002’);
insert into Property values
('2003','Excelsior_House_23_Oracle_Centre_Reading',’3003’);
insert into Property values ('2004','27_Wroxton_Road_London_SE15',’3004’);
I'm keep getting an unknown column error when entering this data.
remove the quotes and backticks when you insert int
values:
insert into Property values
(2001,'Elm_House_11_Short_Lane_Hertfordshire_H5_667',3001);
insert into Property values
(2002,'Jainlight_House_Apple_Lane_Kent_K7_988',3002);
insert into Property values
(2003,'Excelsior_House_23_Oracle_Centre_Reading',3003);
insert into Property values (2004,'27_Wroxton_Road_London_SE15',3004);
Quotes are only needed, when you working with char
fields and backticks are escape characters for table or column names.
I got this error exporting from MariaDb and then importing into MySql. It concerned a field that I had recently added and for which I hadn't added values yet - so in all records this field was empty. When I added a few values for this field the error disappeared.