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 7883925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:39:47+00:00 2026-06-03T04:39:47+00:00

Situation is this: I have a table for staff and another one for course.

  • 0

Situation is this:
I have a table for staff and another one for course.
In course I will have a column called coordinator which will refer to the staff_id.
This is because some staff are coordinators and some are not, etc etc.

Staff_id is an IDENTITY hence it is auto-incrementing and I have to make sure the in the course table, it won’t follow this auto-increment.

I’m just unsure how do I implement the check constraint for this case.

  • 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-06-03T04:39:49+00:00Added an answer on June 3, 2026 at 4:39 am

    If I’m understanding your requirements properly you can add a foreign key constraint to the table so that it references itself:

    ALTER TABLE Staff 
    ADD CONSTRAINT FK_Staff_Coordinator FOREIGN KEY (Coordinator)
    REFERENCES Staff (StaffID)
    

    ADENDUM

    I think I had misunderstood your requirements, I missed the part about a course table. So now I am thinking that the course table needs to link back to the staff table, in which case the command would be:

    ALTER TABLE Course
    ADD CONSTRAINT FK_Course_Coordinator FOREIGN KEY (Coordinator)
    REFERENCES Staff (StaffID)
    

    You are of course free to implement your own naming convention for constraints.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a table called propAmenities which holds two column amenity_id and property_id basically
I'm coming across this situation alot, I'll have a query that will have one
My situation is this. I have a table of products with a pk Parent
My situation is this: We have a superclass, MyAbstractEntity @Entity @Table(name = MyTable) @Inheritance(strategy
I have this situation: MySQL - Newbie question: Which are the PK and the
I have a table of productList in which i have 4 column, now i
I have a table which need new column. The newly introduced column need some
I have a database table as follows: This returns all column titles in the
I have this situation: Table A: +----+------------+ | id | text | +----+------------+ |
I have this situation: { float foo[10]; for (int i = 0; i <

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.