Hello everybody!
I have a task to make a PHP/MySQL website for some music club, and of course, first thing to do is to create and design a good database, which will be useful in the future...
Since this is my first time to design such a 'complex' db :rolleyes: I would like to check if I understood the concept of relational tables correctly so please help me with this easy one =)
Basically, I started with two 'main' tables: Events and Artists.
I created relations in this way:
One artist can play on one or more events and one event consists of one or more artists.
Furthermore, one artist (band) can come from one or more countries and one country can be home for one or more artists.
One artist can have one or more links to their websites, and one website link can be a home page for one or more artists.
One event can be located on one or more locations in town, and one location can be a place for one or more events.
One event can have one or more flayers/posters and one flayer/poster can be a promo for one or more events.
So, I had to get rid of all those many-to-many relations and I created 5 junction tables: artists_events, artists_countries, artists_links, events_locations and events_flayers.
All junction tables have only 2 columns and both of them are foreign and primary key. Each of column is related to primary key of a 'parent' table.
Please tell me if I'm doing this correctly so far??
Right now I'm stuck on a 'Gallery' table because it is related to 3 more tables: Pictures, Artists and Events.
Relations go like this:
One gallery can have one or more pictures but one picture can exist in only one gallery.
One gallery can represent one or more artists and one artist can exist in one or more galleries.
One gallery can hold only one event, but one event can have one or more galleries.
I wonder if this is a good approach to my 'problem'? I am not sure exactly how to make relations between Gallery-Artists-Events here... Can I create another junction table which will have 3 columns which will be related to primary keys of those 3 tables or is there another method to accomplish what I need?
Any suggestions/advice/help is very welcome and appreciated!
Thanks a lot!