MYSQL Relationship between Courses Table with multiple Subcategories from same Category

I’m engineering a MySql database structure for the new version of my website. I need to create a relation between Courses that can have mutiple subcategories but selected only from the same category. I’ve set the relation as you can see in the photo by setting the category foreign key inside course table and linking courses with subcateogries in the middle table and I’m planning to use php to force the user in selecting subcategories only from the same category.

Is there a better and more efficient way to structure the database?

I hope I’ve been clear and thanks for the answers.

Database EER Diagram: enter image description here

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.