Jump to content

Feedback on Data model for Cinema ticket booking system


Go to solution Solved by Barand,

Recommended Posts

Hey Guys,

I think it's going to be better If I have the screening on fixed days. So for instance I have a nav bar that has all the days of the week - So when I click on Monday, it will always show me the same listings, same with Tuesday etc. This way if I want to show someone my website in a months time, I don't have to load new data everytime. This will mean a change to the data model. 

Shall I change screening.screen_on to a varchar and have "Monday" for all of Mondays movies, and "Tuesday" for all of Tuesdays movies or shall I have a seperate entity for the days of the week and do a JOIN.

Thanks

Link to comment
Share on other sites

If you know the date, you know the day of the week.

For example

SELECT m.title
     , s.name as screen
     , date_format(sg.screen_on, '%W, %D %b') as date
FROM screening sg
     JOIN screen s ON sg.screen_id = s.id
     JOIN movie m ON sg.movie_id - m.id
WHERE dayname(screen_on) = 'Wednesday'
ORDER BY screen_on;

giving

+------------------------+------------+---------------------+
| title                  | screen     | date                |
+------------------------+------------+---------------------+
| Mission Implausible    | Screen One | Wednesday, 17th Jan |
| Shaving Ryan's Private | Screen Two | Wednesday, 17th Jan |
+------------------------+------------+---------------------+

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.