Created
March 29, 2015 18:39
-
-
Save licvido/fb9dbe1d10f140b0c3a5 to your computer and use it in GitHub Desktop.
SQL: Date table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `date` ( | |
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, | |
`date` date NOT NULL, | |
`day` tinyint(2) unsigned NOT NULL, | |
`month` tinyint(2) unsigned NOT NULL, | |
`year` year(4) NOT NULL, | |
`day_of_week` tinyint(1) unsigned NOT NULL COMMENT '1 = monday, 7 = sunday', | |
`day_of_year` smallint(3) unsigned NOT NULL COMMENT 'starting from 0 to 365', | |
`week` tinyint(2) unsigned NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment