CREATE TABLE borrow( number BIGINT, borrowname varchar(10), name varchar(10), id BIGINT, phone BIGINT, borrowtime date, returntime date, borrownum BIGINT, PRIMARY KEY(number) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE reader( number BIGINT, borrowname varchar(10), name varchar(10), id BIGINT, phone BIGINT, sex varchar(10), borrownum BIGINT, originalbalance DOUBLE, PRIMARY KEY(number) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DELIMITER %% CREATE TRIGGER reader_borrow AFTER INSERT ON reader FOR EACH ROW INSERT INTO borrow VALUES( NEW.number, NEW.borrowname, NEW.name, NEW.id, NEW.phone, NOW(), DATE_ADD(NOW(),INTERVAL 30 DAY), NEW.borrownum ) %% DELIMITER ; INSERT INTO reader VALUES(1,'《所有》','刘江林',20217329,17264440107,'1',100);出现1136 - Column count doesn't match value count at row 1错误
时间: 2023-12-27 10:05:05 浏览: 121
create table
5星 · 资源好评率100%
在执行最后一条SQL语句时,你在reader表中插入了7个值,但是reader表中定义了8个列。因此,你需要在INSERT语句中指定8个值,或者在表中删除一个列。
可以将INSERT语句修改为:
```
INSERT INTO reader VALUES(1,'《所有》','刘江林',20217329,17264440107,'1',100, 0.0);
```
其中0.0是originalbalance列的默认值。这样就可以成功插入一条记录了。
阅读全文