Answer the question
In order to leave comments, you need to log in
Can you help me come up with a database structure (mysql)?
We need to come up with a competent implementation of the structure of the cinema poster.
There is a `cinemas` table - a list of cinemas
. A `films` table - films.
It is necessary to link them somehow, taking into account sessions and dates.
I just can't think of the best way to build the architecture of the database.
It leads to a dead end with session times and dates (somehow I don’t want to add a movie with a new session for each day, but I just want to add films separately, separately cinemas, etc., so that you can link all this data and reuse it already ).
I hope I explained it intelligibly, although I can hardly do it (
Here, for example, https://afisha.yandex.ru/msk/events/?category=cinemaallows you to select a movie, cinema, date separately and I don’t think that there is duplicate data for each day / session
Answer the question
In order to leave comments, you need to log in
Everything is extremely simple. Comrades are right.
As a result, you should get 3 main tables: cinemas , films , sessions . For the time being, we discard the rest of the data, we do not need them.
We need all this data to be interconnected, and they should be interconnected just with the help of sessions .
tablein the cinema_id and film_id columns, specify the id of the cinema and the movie, respectively.
As a result, we get that films , and cinemas , and sessions live their own lives, apart. If we make a separate table for the days for which sessions will already be created, then we will gain almost nothing in performance, although it all depends on the selections.
Make a table of sessions (id, date_time, film_id, cinema_id, hall_id)
date_time - date and time of the session start
hall_id - cinema hall
I'll try to convey the idea without writing at all. approximately the following tables:
cinemas (id, name, ...), sessions (id, name, time, cinema id),
films (id, name, category), movies - cinema theaters (id, movie id, cinema id)
actors ( id, name), movie actors (id, movie id, actor id)
you can also: discounts (time, date, whatever), discounts - cinemas - movies (id, discount id, movie id. movie id (if any) ) , movie awards(id, movie id), actor awards and so on
Linking table Movie-Session-Date-Cinema, but maybe I misunderstood you
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question