Hello, I'm writing my first model and I wonder if someone can make sure it will work for my project. My one concern is that I had a fan trap and my solution leads to a potential chasm trap.

The objects are going to be business listings. Business listings may have genres, may have a category, but will always have a section. Some sections have categories, some don't. That's the problem. I need to be able to query my database by object properties, category, section, and genre. I'm thinking that for sections with no category I can make a category named NONE but that doesn't seem like much of an elegant solution.

If someone could see if my model looks ok and if anyone has any advise it'd help me out a lot.

I see the relationships, but don't see the actual columns.
In the business table, you need the columns GENRE_ID, CATEGORY_ID, and SECTION_ID.

For the businesses without categories, you can just set the column to be null.

Indeed the table business should have the following columns:

genre it can be null
section it can be null
category not null

A section can have:
no category
only one category

In this case is ok to add to the table section the field category and it can be NULL

What is the relation between category and section?


A section can have more than one category?
A category can belong to more than one section?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.