MYSQL错误1062重复密钥为主PRIMARY

时间:2015-08-09 15:27:48

标签: mysql

我是这一切的新手,我正在努力解释为什么一直这么说。

这是我的代码:

Use Client_info;

Create table Session_Log (
    Client_ID INT,
    session_ID INT,
    Staff_ID INT,
    Session_Duration varchar(10)
);

INSERT INTO Session_log (Client_ID, session_ID, Staff_ID,Session_Duration)
    Value ("2245","22897","6574","2hours");

INSERT INTO Session_log (Client_ID, session_ID, Staff_ID,Session_Duration)
    value ("9975","01287","1089","1hour");

INSERT INTO Session_log (Client_ID, Session_ID, Staff_ID,Session_Duration)
    Value ("3847","25601","5160","3hours");

INSERT INTO Session_log (Client_ID, Session_ID, Staff_ID,Session_Duration)
    Value ("7420","25601","1089","1hour");

INSERT INTO Session_log (Client_ID, Session_ID, Staff_ID,Session_Duration)
    Value ("3449","38145","8793","2hours");

INSERT INTO Session_log (Client_ID, Session_ID, Staff_ID,Session_Duration)
    Value ("1125","22897","1125","4hours");

INSERT INTO Session_log (Client_ID, Session_ID, Staff_ID,Session_Duration)
    Value ("1884","20076","5160","1hour");

INSERT INTO Session_log (Client_ID, Session_ID, Staff_ID,Session_Duration)
    Value ("4937","01287","2265","3hours");

INSERT INTO Session_log (Client_ID, Session_ID, Staff_ID,Session_Duration)
    Value ("2985","22897","6574","3hours");

INSERT INTO Session_log (Client_ID, Session_ID, Staff_ID,Session_Duration)
    Value ("1129","25601","8793","1hour");

我实际上对编码知之甚少,所以请善待我。

完整CREATE TABLE

CREATE TABLE session_log (
  Client_ID int(11) DEFAULT NULL,
  session_ID int(11) DEFAULT NULL, 
  Staff_ID int(11) NOT NULL DEFAULT '0',
  Session_Duration varchar(10) DEFAULT NULL, 
  PRIMARY KEY (Staff_ID)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

0 个答案:

没有答案