-2

This schema is cataloguing restaurant data.

restaurant schema

Open_hours stores hours for each day of the week, referencing the days table for day of the week.

Special_hours is a table for any days in a calendar year when a restaurant may have modified hours

For tables like analytics, I'm unsure whether or not it needs its own primary key since its rows are directly dependent on the business_id.

I'm also not sure whether the junction table is necessary between attributes and attribute_params. Some attributes are simply boolean TRUE if they exist, such as "wheelchair_accessible"

But for values like "wifi" there may be a non-boolean parameter like "no," "free" or "paid"

What mistakes if any am I making with my composite keys / junctions? Am I missing any that should exist?

Should I create primary keys for tables like analytics or attribute_params?

Edit:

I believe I was missing a junction table between open_hours and days so I added that.

Bozo
  • 27
  • 4
  • Let's see the SELECTs. – Rick James May 09 '22 at 22:33
  • 1
    What is your 1 (specific researched non-duplicate) question? Where are you 1st stuck/unsure in what published presentation of what design method? [ask] [Help] – philipxy May 09 '22 at 23:15
  • Please use text, not images/links, for text--including tables & ERDs. [Why should I not upload images of code/data/errors when asking a question?](https://meta.stackoverflow.com/q/285551/3404097) [More.](https://meta.stackexchange.com/q/320052/266284) Paraphrase or quote from other text. Give just what you need & relate it to your problem. Use images only for what cannot be expressed as text or to augment text. Include a legend/key & explanation with an image. PS ERD as text is DDL. PS Please don't insert "EDIT"s/"UPDATE"s, just make your post the best presentation as of edit time. – philipxy May 10 '22 at 00:15
  • Re the "attributes" zone: [What is better option for product attribute database design?](https://stackoverflow.com/a/2945124/3404097) [How to design a database for User Defined Fields?](https://stackoverflow.com/q/5106335/3404097) [Re EAV.](https://stackoverflow.com/a/23950836/3404097) Please before considering posting read the manual/reference & google any error message & many clear, concise & precise phrasings of your question/problem/goal, with & without your particular names/strings/numbers, 'site:stackoverflow.com' & tags; read many answers. If asking reflect research. – philipxy May 10 '22 at 02:16

0 Answers0