2012-02-25 59 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的列。