【发布时间】:2017-09-18 10:52:28
【问题描述】:
我想在表格中插入一个数据集。插入查询应该将数据插入到两个表中。
这是表格:
表 A:
ID, customerId, ..[some other columns]...
表 B:
customerId, name
查询应该插入到表 A 和表 B 中。如何将值插入到表 B 中,关系为 customerId?
编辑:DBMS 是 sqlite。
定义:
适应:
- id -> 整数不为空
- customerId -> 整数不为空
- 一些文本列....
客户:
- customerId -> 整数非空
- 名称 -> 文本不为空
【问题讨论】:
-
您使用的是哪个 DBMS?后格雷斯?甲骨文?
-
写两条插入语句,每个表一个。如果其中一个表恰好是客户表,那么这个插入必须是第一个。
-
向我们展示表定义。
-
DBMS 是 sqlite。定义:适应:id -> integer not null,customerId -> integer not null,一些文本列; // 客户:customerId -> integer not null, name -> text not null
-
编辑问题