artisticre Posted July 21, 2009 Share Posted July 21, 2009 I have a night club website that wants a database done. There are two tables, one for Events and one for Venue. Each venue could have many events but each event would have one venue. Could someone look at my tables to see if the relationships are correct? Also, could someone suggest a way that might optimize these tables as much as possible? Events event_id (PK) eventtype eventdate eventtime eventinfo Venue venue_id (PK) name address city state zip clubtype phone musictype info featured event_id Quote Link to comment https://forums.phpfreaks.com/topic/166800-stuck-on-relationships-for-a-database-please-help/ Share on other sites More sharing options...
rhodesa Posted July 21, 2009 Share Posted July 21, 2009 since each event has only one venue, the event would have the venue_id, not vice versus. also, date and time can be in one field: Events event_id (PK) eventtype eventdatetime eventinfo venue_id Venue venue_id (PK) name address city state zip clubtype phone musictype info featured Quote Link to comment https://forums.phpfreaks.com/topic/166800-stuck-on-relationships-for-a-database-please-help/#findComment-879546 Share on other sites More sharing options...
kickstart Posted July 21, 2009 Share Posted July 21, 2009 Hi Would move the many relationship key:- Events event_id (PK) eventtype eventdate eventtime eventinfo venue_id Venue venue_id (PK) name address city state zip clubtype phone musictype info featured All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/166800-stuck-on-relationships-for-a-database-please-help/#findComment-879547 Share on other sites More sharing options...
artisticre Posted July 21, 2009 Author Share Posted July 21, 2009 Thanks for the reply. When I insert into these tables, which table would I insert into first? Hi Would move the many relationship key:- Events event_id (PK) eventtype eventdate eventtime eventinfo venue_id Venue venue_id (PK) name address city state zip clubtype phone musictype info featured All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/166800-stuck-on-relationships-for-a-database-please-help/#findComment-879560 Share on other sites More sharing options...
rhodesa Posted July 21, 2009 Share Posted July 21, 2009 Well, you should only have one row in Venues per venue. Most places would have this table populated already. Either way though, the venue must exist, so you can get it's id, before you can insert the event int the events table. Quote Link to comment https://forums.phpfreaks.com/topic/166800-stuck-on-relationships-for-a-database-please-help/#findComment-879566 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.