简体   繁体   中英

Preferable database design for two related tables

I have a table for a job post, something like:

`job_post`
  - name
  - position

`job_application`
  - profile (FK)
  - job_post (FK)  

In other words someone posts a job, job_post , and people can apply to that job, job_application .

I want to add an ability to award a job to an individual. For example, if Users 1-10 applied for the position of Plumber, that position could be awarded to User 6.

Where should I add the concept of awarding a project? I do not want to add an additional table for something so small. Which would be preferable --

Option 1 - on job_post :

`job_post`
  - name
  - position
  - awarded_to (FK to profile, else Null if hasn't been awarded yet)

Option 2 - on job_application :

`job_application`
  - profile (FK)
  - job_post (FK)  
  - awarded (boolean field, default = 0, if awarded = 1)

In addition, would adding this column to one of the above tables be an example of denormalizing the db structure? If so, why?

Job_post is going to be awarded to a Job_application, that's the concept i can read. Then, with that logic, if only one application can be awarded to only one job, the first option is feasible. If more than one applicant can be awarded with the job post, then the second option is the correct one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM