Muthu Muthu - 1 year ago 45
MySQL Question

Database Design for sub columns or many to many relations

If I have a list of theatres and in each theatre there are several classes of tickets eg. Rs.120, Rs.100 etc. These classes will apply for morning, noon and night shows. So all the classes of tickets will be available for all the shows(Many to Many Relationship) I need to model this as a database. I have a problem in modelling the classes and show timings. This makes the data base redundant.

Input Excel data

Answer Source

A good rule of thumb, is when you hit redundant data, make a new table. Here is how I would break it down, though you could break it down further (also see a term normalize):

Tables: theater_tbl ticket_tbl classes_tbl

relate each ticket to a class, and each theater may sell one or more tickets of any given class.

Information like address of theater go with theater_tbl Ticket pricing would go in the ticket table under the type of ticket, unless I misunderstand what a class of ticket is, then the pricing should go there. The time of day a ticket relates to should go in the ticket table.

This should get you started. To go further, you could break down show times into another table, and relate classes/tickets to those show times.

Its hard to draw out without a solid example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download