我正在尝试插入以下值
('PA', 'Hilda Blainwood', 3, 10.7, 4308.20, '9/8/1974', '9:00', '07/03/1996 10:30:00');
使用以下结构 alltypes
create table alltypes( state CHAR(2), name CHAR(30), children INTEGER, distance FLOAT,
budget NUMERIC(16,2), checkin TIME, started TIMESTAMP);
弹出以下错误
test=# insert into alltypes VALUES('PA', 'Hilda Blainwood', 3, 10.7, 4308.20, '9/8/1974',
'9:00', '07/03/1996 10:30:00');
ERROR: INSERT has more expressions than target columns
LINE 1: ...Blainwood', 3, 10.7, 4308.20, '9/8/1974', '9:00', '07/03/199...
答案 0 :(得分:5)
错误消息非常自我解释:您正在尝试插入表中包含列的更多值。您的表有七列,但您的VALUES表达式有八个值。
顺便说一句,你应该在INSERT时指定列:
insert into alltypes (state, name, children, distance, budget, checkin, started)
values (...)