i created this table
create table courses (
cid int primary key not null,
cname varchar(25) )
and when i tried to insert any thing like that
insert into courses values (1,name)
i have this error
insert into courses values (1,`ahmed`)
Error Code: 1054. Champ 'ahmed' inconnu dans field list 0.000 sec
when i try to add only cid it's ok , i removed the table and created it twice and the same problem
what is the wrong thing here?
You need to delimit your varchar
values with single quotes ( '
).
Try the following instead:
insert into courses values (1,'ahmed');
Numerics can be passed without the single quotes, however any char
or varchar
derived types need the single quotes. Look up datatypes
for SQL
for further information.
Put Single quote (') for string values
Try this:
INSERT INTO courses (cid, cname)
VALUES (1, 'ahmed');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.