开发者

Question regarding efficient table usage in MySQL

开发者 https://www.devze.com 2023-02-09 12:17 出处:网络
I want my users in my web app to be able to sign up for different \"events\". Each event has things describing it such as name, date of event开发者_如何学Python, the description, and people describing

I want my users in my web app to be able to sign up for different "events". Each event has things describing it such as name, date of event开发者_如何学Python, the description, and people describing the event. Should I create an individual table for each event? Or should I have an event be a row/column in an event table?


Events would normally be modelled as rows in an Event table.


In a relational database you would create multiple tables, each one for a different aspect of the event. so you could have an organiser table a location table and an events table

In the event table you would have the id of the organiser and the id of the location, and then data about the event. So the three tables describe the event more fully but you don't need to repeat data. An organiser may have multiple events, at multiple locations. each organiser and location only needs one entry (usually) in their respective tables.

DC

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号