derby sql insert

时间:2012-02-25 11:31:53

标签: sql derby

我试图在我的数据库中插入值 这是我尝试执行的语句:

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.

有什么问题?

1 个答案:

答案 0 :(得分:12)

要插入字符串,例如"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的列。