sql - Derby SQL插入

标签 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.

问题是什么?

最佳答案

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

关于sql - Derby SQL插入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9443599/

相关文章:

sql - 替换参数无效

javascript - 从查询sql数据库获取数据到javascript

mysql - SQL:获取具有最高 ID 的行,但如果填充了特定列,则获取该行

ubuntu - 无法从 $HIVE_HOME 以外的任何其他位置启动配置单元

java - 莫名其妙的 NullPointerException,至少看起来是这样

Java 数据库 : No Suitable Driver Found

sql - 自动调整范围表

mysql - 外键的语法差异 MySQL/PostgresQL

java.lang.NoClassDefFoundError JPA 示例

java - Derby 数据库的 SQL 语句错误