How to fix error # 1054 unknown column in the field

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 get an unknown column error while entering this data.

+4
source share
2 answers

remove quotes and backlinks when pasting values int:

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 work with fields charand backticks are escape characters for table or column names.

+8
source

, MariaDb, MySql. , , , . , .

+1

All Articles