mo Posted July 19, 2010 Share Posted July 19, 2010 I have the following table defined for poker game schedules. The table will be queried using keys venue ID, game type ID and day of the week from the main game table. There can be more than one of the same game for the same venue on the same day just at different times or even at the same time. So, should I use an auto increment field as a key (as below) or just include start/end time as keys? CREATE TABLE `game_schedule` ( `sid` int(11) NOT NULL auto_increment, `venue_id` int(11) NOT NULL COMMENT 'Venue ID', `game_type_id` varchar(10) NOT NULL COMMENT 'Game ID', `day_of_week` int(1) NOT NULL COMMENT 'Day of The Week', `start_time` time NOT NULL COMMENT 'Start Time', `end_time` time NOT NULL COMMENT 'End Time', PRIMARY KEY (`sid`,`venue_id`,`game_type_id`,`day_of_week`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Venue Games Schedule' AUTO_INCREMENT=1 ; Quote Link to comment https://forums.phpfreaks.com/topic/208208-scheduling-table-design/ Share on other sites More sharing options...
fenway Posted July 21, 2010 Share Posted July 21, 2010 Always use an auto-increment, especially if not innodb. Quote Link to comment https://forums.phpfreaks.com/topic/208208-scheduling-table-design/#findComment-1089313 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.