这是我的桌子
mysql> describe clients;
+------------+---------------------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------------------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(50) | YES | | NULL | |
| membership | enum('Silver','Gold','Diamond') | YES | | NULL | |
| interest | set('Movie','Music','Concert') | YES | | NULL | |
+------------+---------------------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
如果我尝试
INSERT INTO clients (name, membership,interest) VALUES ('Pizda','Gold', 'Music'),('Kratez','Premium', 'Movie,Concert');
比我有问题
ERROR 1265 (01000): Data truncated for column 'membership' at row 2
截断的数据指的是什么?
答案 0 :(得分:1)
枚举membership | enum('Silver','Gold','Diamond')
没有值Premium
。
CREATE TABLE clients(
id INT(11) PRIMARY KEY AUTO_INCREMENT,
membership enum('Silver','Gold','Diamond')
);
INSERT INTO clients(membership)
VALUES('Premium');
-- Data truncated for column 'membership' at row 1
INSERT INTO clients(membership)
VALUES(NULL);