Need a little feedback on my database design, pretty simple

I will allow companies to register on my site and create job listings.

I am currently facing a problem by creating a company table with the Name, Logo and Password fields. Then, when a person is registered, he can say: "I belong to X company"; at this point I will ask for the password written by the initial registrar. If he / she enters the correct password, he is granted permission to create job advertisements in the name of the company.

Why I do this: If I just placed everything inside the Company table, each new user would have to create an account and I would have redundant information, CompanyName, logo, etc.

And if I do something without a password, everyone can post a vacancy by opening the company name, and this is simply wrong.

Do you have the opportunity to share some results? Am I doing something wrong? How would you do that?

+4
source share
4 answers

I would fulfill "job requests", for example, requests from Facebook users, and if the user really works in this company, the company manager just needs to log in and confirm it.

+5
source

Normalization of the database.

Create a separate table of users and companies. Can a user send messages to multiple companies? if so, you need a many-to-many relationship (which requires a third table to track relationships). Otherwise, one-to-many should work.

+3
source

You must create two tables:

Company: - id - logo ( - name, etc ) User - id - companyId (foreign key to Company.id ) - password ( - username, etc. ) 

Thus, the User is a subsidiary of the Company identified by the company. Now, if the user enters the system, you can determine which company he / she belongs to by finding the company corresponding to the company. Now you have a password for each user and a company per user.

And, as Jimmy says, if you need users to be part of a larger company, you will receive:

 Company - id - logo User - id - password Company_User - companyId (foreign key to Company.id ) - userId (foreign key to User.id ) 
0
source

in my opinion you should create a table like

Employers:

  eid(pk) logo Username Password profile etc.... 

Employees:

  jid(pk) Username Password etc... 

JobPosts:

  id(pk) eid(Fk to Employers.eid) JobTitle Specifications.... 
0
source

Source: https://habr.com/ru/post/1302502/


All Articles