How to handle different types of one table?

Viewed 83

I am trying to create a database where a User can make a Post. There are different types of posts: A regular text post, a job post, product post, or question post.

I am trying to figure out the correct way of setting up my tables. I want each post to be able to be only one of the types. Whatever type it is, I want to connect it to the appropriate foreign table to retrieve the information necessary.

For example, if I want to make a job post, I want the post to be connected to a Job table. Likewise, if I have a question post, I want the Post to be connected to a Question table.

Do I have to create a connecting table for each type that I want? Or is there a way to make one connecting table for each type? Is there a way to create a Post_Type table?

Here is a diagram of what I am currently thinking it needs to look like

enter image description here

0 Answers
Related