Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7563123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:35:02+00:00 2026-05-30T13:35:02+00:00

This might be simple one but I am finding it very difficult to work

  • 0

This might be simple one but I am finding it very difficult to work around it.

I have got 3 tables like; Employee, manager, supervisor in here manager and supervisor is the specialization of the table employee. Now I have got another table say Project which should have 1 manager and 3 supervisor.

How do I put this in my mysql database?

As Employee has Employeeid, name, position and manager will have employeeid as pk and fk sme with supervisor which will have employeeid as pk and fk. How do I put the data in manager and supervisor table? Do I use a view?

How would mysql know which is manager and which is supervisor?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:35:03+00:00Added an answer on May 30, 2026 at 1:35 pm

    How to connect your tables:

    You can make an additional table ProjectMember with the following columns:

    employeeId
    projectId
    role
    

    Where role can be ‘manager’ or ‘supervisor’.

    So, if these are your Employees:

    employeeId    name
    1             Mark
    2             Steve
    3             Simon
    4             Stan
    

    And this is your Project:

    projectId    name
    1            Project X 
    

    Then the ProjectMember table can have the following rows:

    employeeId projectId role
    1          1         manager
    2          1         supervisor
    3          1         supervisor
    4          1         supervisor
    

    To get the names of all members of Project X you can then use the following query:

    SELECT emp.name AS name, pm.role AS role
    FROM ProjectMember pm
    JOIN Employee emp
    ON pm.employeeId = emp.employeeId
    WHERE pm.projectId = 1
    

    This will return:

    name   role
    Mark   manager
    Steve  supervisor
    Simon  supervisor
    Stan   supervisor
    

    Adding specializations

    If there is any specific data for a Manager or a Supervisor as specializations of Employee, then you can retrieve the additional data as follows.

    Suppose Mark is a Manager, then this can be a row in Manager:

    employeeId clearanceLevel
    1          10
    

    EDIT: To store a Manager, you first store an Employee and get its (probably generated) employeeId. How to get a generated id depends on the database system you are using (see this on MySQL). Then you store a row in Manager with that same employeeId.

    To get this additional information, while you do not really know who is in the Manager table on beforehand, you can use a LEFT JOIN to retrieve data from optional additional tables (they may or may not be there, but you still want to get the basic queried rows):

    SELECT emp.name AS name, pm.role AS role, mgr.clearanceLevel AS clearanceLevel
    FROM ProjectMember pm
    JOIN Employee emp
    ON pm.employeeId = emp.employeeId
    LEFT JOIN Manager mgr
    ON mgr.employeeId = emp.employeeId
    WHERE pm.projectId = 1
    

    This will return:

    name   role       clearanceLevel
    Mark   manager    10
    Steve  supervisor NULL
    Simon  supervisor NULL
    Stan   supervisor NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought this might be simple but i guess it's not, i have like
I feel like this might be really simple but I'm just not getting it
I know this might be very easy to some,, I have a simple string
This might be a simple one, but I can't seem to find an easy
This might be a simple one for you guys, im learning Javascript and have
All this might look too trivial but read it through - I have simple
This might be a simple question, but I moved one of my apps from
This might be simple but I'm starting out with rails. I have the following
This might be simple question but have confused me for sometime. I'm developing an
this might be a simple questions but I can't get my head around it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.