DROP TABLE IF EXISTS diaries;
CREATE TABLE diaries (
day DATE PRIMARY KEY,
title TEXT
) DEFAULT CHARSET=UTF8MB4;
INSERT INTO diaries (day, title)
VALUES ("2012-02-14", "clear day")
ON DUPLICATE KEY UPDATE title = "clear day (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-14", "rainy day")
ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-15", "cloudy day")
ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)";
SELECT * FROM diaries;
day	title
2012-02-14	rainy day (duplicated)
2012-02-15	cloudy day
DROP TABLE diaries;
