我是MySQL的新手,请你帮我一下这些条目。我想进入下面的表格,但我收到了以下错误
*ERROR 1062: 1062: Duplicate entry '2014-03-14' for key 'PRIMARY'*
SQL Statement:
INSERT INTO `database`.`table1` (`Date`, `ID Number`, `Type`, `Time1`, `Time2`, `Time3`, `Time4`, `Time5`) VALUES ('2014-03-14', 'UCN1121A', 'Others', '1', '7', '45', '3', '17')
Date ID Number Type Time1 Time2 Time3 Time4 Time5
3/14/2014 ID1 Type1 2 4 5 10 12
3/14/2014 ID1 Type2 1 7 45 3 17
3/14/2014 ID1 Type3 0 0 1 0 2
3/14/2014 ID1 Type4 1 0 0 0 0
3/14/2014 ID1 Type5 0 3 5 0 0
3/14/2014 ID1 Type6 0 0 0 0 0
3/14/2014 ID1 Type1 3 1 3 5 1
3/14/2014 ID2 Type2 3 0 0 2 1
3/14/2014 ID3 Type3 12 4 5 7 8
3/14/2014 ID4 Type4 0 0 0 0 0
3/14/2014 ID5 Type5 0 0 0 8 0
3/14/2014 ID6 Type6 0 0 0 0 0
3/14/2014 ID3 Type1 0 1 4 1 0
3/14/2014 ID4 Type2 12 15 69 34 15
3/14/2014 ID5 Type3 0 0 0 0 0
3/14/2014 ID6 Type4 13 2 46 8 9
3/14/2014 ID7 Type5 0 0 0 0 0
3/14/2014 ID8 Type6 0 0 0 0 0
答案 0 :(得分:0)
Date
表中的table1
列是主键。这意味着表中的每一行都必须具有此列的唯一值。如果尝试插入具有表中已存在的主键列值的行,则数据库引擎将不允许该行。这就是错误信息的含义。将insert语句中Date
列的值更改为唯一值,或从该列中删除主键指定。