Im trying to execute the following query on my mysql database:
INSERT INTO `adabtc` (`time`, `open`, `high`, `low`, `close`, `volume`) VALUES
('2018-03-30 02:00:00','0.00002002', '0.00002031', '0.00002000', '0.00002011', '105.88731690')
and I get the following error:
1062 - Duplicate entry '2018-03-30 03:00:00' for key 'PRIMARY'
Notice the date in the query is different from the duplicate one.
Create Table:
CREATE TABLE `adabtc` (
`time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`open` double NOT NULL,
`high` double NOT NULL,
`low` double NOT NULL,
`close` double NOT NULL,
`volume` double NOT NULL,
PRIMARY KEY (`time`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
also running the query:
SELECT * FROM `adabtc` WHERE time BETWEEN '2018-03-30 01:00:00' AND '2018-03-30 03:00:00'
gives me the following outcome:
2018-03-30 01:00:00 0.00001983 0.00002003 0.00001968 0.00002001 110.25848914
2018-03-30 03:00:00 0.00002002 0.00002031 0.00002 0.00002011 105.8873169
SOLVED: changed type from timestamp to datetime and the issue was resolved. Thanks @RaymondNijland