SQLite Manager INSERT INTO 失败但不产生错误
SQLite Manager INSERT INTO fails but produces no error
我有一个 SQLite 数据库 table:
table: import_info
Columns: First_Name, Last_Name, Payroll_ID, ... other columns not used
tabel employees
Columns: name, employee_num
我想 select 来自第一个 table 的唯一名称和 payroll_id 进入员工 table 作为 name
和 employee_num
.
如果我 select SQLite Manager 中的 table 和 运行:
SELECT DISTINCT Last_Name || ' ' || First_Name AS name, Payroll_ID
AS employee_num
FROM import_info
我得到了完美的结果。但如果我尝试:
INSERT INTO employees (name, employee_num)
SELECT DISTINCT Last_Name || ' ' || First_Name AS name, Payroll_ID
AS employee_num
FROM import_info
我一无所获。没有错误,什么也没有发生。
您可以提供以下值:
INSERT INTO employees(name, employee_num, created_at, updated_at)
SELECT DISTINCT Last_Name || ' ' || First_Name AS name, Payroll_ID,
datetime('now'), datetime('now')
FROM import_info
不过,令我惊讶的是,省略值不会导致错误。也许有什么东西抑制了错误。
我有一个 SQLite 数据库 table:
table: import_info
Columns: First_Name, Last_Name, Payroll_ID, ... other columns not used
tabel employees
Columns: name, employee_num
我想 select 来自第一个 table 的唯一名称和 payroll_id 进入员工 table 作为 name
和 employee_num
.
如果我 select SQLite Manager 中的 table 和 运行:
SELECT DISTINCT Last_Name || ' ' || First_Name AS name, Payroll_ID
AS employee_num
FROM import_info
我得到了完美的结果。但如果我尝试:
INSERT INTO employees (name, employee_num)
SELECT DISTINCT Last_Name || ' ' || First_Name AS name, Payroll_ID
AS employee_num
FROM import_info
我一无所获。没有错误,什么也没有发生。
您可以提供以下值:
INSERT INTO employees(name, employee_num, created_at, updated_at)
SELECT DISTINCT Last_Name || ' ' || First_Name AS name, Payroll_ID,
datetime('now'), datetime('now')
FROM import_info
不过,令我惊讶的是,省略值不会导致错误。也许有什么东西抑制了错误。