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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:46:18+00:00 2026-05-23T14:46:18+00:00

Simple question, can’t seem to find an answer on Google. I’m normalizing a database

  • 0

Simple question, can’t seem to find an answer on Google. I’m normalizing a database and I’m converting one of the tables to 2nd Normal Form. Question is: can the primary key of a table also be a foreign key in that same table?

If it makes it easier to understand, I’m trying to eliminate the partial dependencies in the table (but that was probably obvious since I mentioned 2nd Normal Form).

I have the table JobItem, which looks like this:

Job No (PK),
Item Code (PK),
PO Num,
Item Description,
Item Type,
Vendor,
Job Name

Job Name is partially dependent on the Job No component of the key.
Item Description, Item Type and Vendor are dependent on the Item Code component.
PO Num is dependent on the entire key.

What I’m asking is once I strip out the partial dependencies into their own tables, will the components of my key also become foriegn keys to reference the new tables?

EDIT: Fleshed out the example to be a bit more relevant.

  • 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-23T14:46:19+00:00Added an answer on May 23, 2026 at 2:46 pm

    You’ll get better answers if you post the DDL of the table. (Post the CREATE TABLE script.) As a rule of thumb, always post DDL and INSERT statements for sample data.

    Question is: can the primary key of a
    table also be a foreign key in that
    same table?

    Yes, but that doesn’t descibe your situation. Your primary key is in one table (Table B), and your foreign key is in a different table (Table A).

    A self-referencing foreign key, in which a foreign key in Table A references a candidate key that’s also in Table A, is relatively uncommon. That is, foreign keys that reference other tables are much, much more common than foreign keys that reference their own table.

    In fact, you can find quite a few designs on SO–and not just on SO–that use self-referencing foreign keys when they really shouldn’t. That’s another good reason to post DDL.

    Later

    What I’m asking is once I strip out
    the partial dependencies into their
    own tables, will the components of my
    key also become foriegn keys to
    reference the new tables?

    Yes. There are rare instances where the columns of a multi-column candidate key actually need to reference different tables entirely. But in your case, it looks like you’re right–the columns of your key should reference the primary keys in the new tables.

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

Sidebar

Related Questions

Simple question, but one I can't find an answer to on the MSDN subscriber
Seems like a simple enough question but I can't seem to find the answer.
Simple question I can't seem to find the answer to. I'm trying to squeeze
This is probably a simple question but I can't seem to find the solution.
I've got a really simple rails question here but I can't seem to find
This is just a simple question, and I can't find the answer in the
Pretty simple question that I can't quite find the answer for: Is there a
A simple question that I can't find an answer for in Microsoft's error lookup
This seems like a simple question, but I can't find it with the Stack
I have a simple question that I can't find anywhere over the internet, how

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.