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

The Archive Base Latest Questions

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

I know this is pretty elementary but here it goes. I would like to

  • 0

I know this is pretty elementary but here it goes.

I would like to know how you know what columns are a primary key in a table that does not have a primary key? Is there a technique or something that I should read?

Thank you in advance

  • 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-25T13:02:59+00:00Added an answer on May 25, 2026 at 1:02 pm

    You need to take a look at your data structures.

    A primary key must:

    • never be NULL (no exceptions)
    • reliably and uniquely identify each single row

    and it helps if it’s

    • small and easy to use
    • stable (doesn’t change at all, or at least not often)
    • a single column (or at most two)

    Check your data – which columns or set of columns can fulfill these requirements??

    Once you have those potential primary keys (the “candidate keys”) – think about how you will access the data, and what other data might need to be associated with this one entity in question – what would make sense as a foreign key? Do you want to reference your department by its name? Probably not a good idea, since the name could be misspelled, it might change over time etc. By the department’s office location? Bad choice, too. But something like a unique “department ID” might be a good idea.

    If you don’t find any appropriate column(s) in your actual data that could serve as primary key and would make sense, it’s a common practice to introduce a “surrogate key” – an extra column, often an INT (and often something like an “auto-increment” INT) that will serve as an artificial identifier for each row. If you do this, one common best practice is to never show that artificial key on any data screen – it has no meaning whatsoever to the users of your system – so don’t even show it to them.

    Checking these requirements, and a lot of experience, will help you find the right primary key.

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

Sidebar

Related Questions

So I'm pretty sure i already know the answer to this, but does the
I know this should be a pretty elementary issue to fix, but 1) I'm
I'm pretty sure I know the answer to this, but short of a virtual
I know this is pretty basic but I've kind of been guessing up to
I know this is pretty basic, but why do variables in master pages lose
Ok I know this is pretty broad, but let me narrow it down a
I know this is not very pretty code and that I'm sure there is
I know this sounds pretty trivial, but I'm new to jQuery... I use this
I know this should be pretty simple and the shell version is something like:
Ok. I know this is probably pretty simple, but I am having a difficult

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.