2012-02-25 90 views
3

我想在我的数据库 这将值是我尝试执行语句:德比SQL INSERT

insert into leverancier (id,naam,straat,nr,postcode,plaats,telefoon) 
    values (1,"stef","bosstraat",88,9240,"Zele",null); 

我得到以下错误:

ERROR 42X04: Column 'stef' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'stef' is not a column in the target table. 

是什么问题?

+0

我猜字符串应该用单引号分隔。 – Phil 2012-02-25 11:42:41

回答

11

要插入字符串,如"stef",请勿使用双引号,而应使用单引号:'stef'。这里的说法应该是这样:

INSERT INTO leverancier 
    (id, naam, straat, nr, postcode, plaats, telefoon) 
VALUES 
    (1,'stef', 'bosstraat', 88, 9240, 'Zele', NULL); 

Column 'stef' is either not in any table ...这个错误是因为双引号被用于表和列名。因此,读取"stef"时,解析器假定您指的是名为stef的列。