DROP TABLE IF EXISTS ranges;
CREATE TABLE ranges (
id INT PRIMARY KEY,
start DATE,
end DATE,
UNIQUE KEY range_key(start, end)
);
INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05");
Warnings:
Warning	1265	Data truncated for column 'start' at row 1
INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31");
Warnings:
Warning	1265	Data truncated for column 'start' at row 1
Warning	1265	Data truncated for column 'end' at row 1
INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31");
Warnings:
Warning	1265	Data truncated for column 'end' at row 1
INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01");
Warnings:
Warning	1265	Data truncated for column 'start' at row 1
Warning	1265	Data truncated for column 'end' at row 1
SELECT * FROM ranges FORCE INDEX(range_key)
WHERE start = "1000-01-01" AND end = "9999-12-31";
id	start	end
DROP TABLE ranges;
