DROP TABLE IF EXISTS diaries;
CREATE TABLE diaries (
id INT PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(40),
created_at DATE,
KEY (created_at)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29");
INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30");
INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31");
SELECT * FROM diaries;
id	title	created_at
1	clear day	2012-01-29
2	rainy day	2012-01-30
3	cloudy day	2012-01-31
SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30";
id	title	created_at
1	clear day	2012-01-29
2	rainy day	2012-01-30
DROP TABLE diaries;
