Do all tables have to have a primary key?

M

maura

I have a few people in my office that are building a new database. A few of
the tables they do not have a primary key set. These tables are very minor
and they will be used as look-up tables, but I thought every table should
have a primary key, no matter how minor the table. What are your thoughts...

I usually set an autonumber on the tables like this as a primary key. Am I
teaching good habits or just going overboard? Thanks, m.
 
J

Jeff Boyce

Maura

Are you trying to start a religious war or something?! <g>

Can you create a table in Access that has no primary key? - Yes.

Does a "minor... look-up" table work without having a primary key? - Yes.
(but define "minor"...)

At least in theory, any row in any table needs a way to uniquely identify
that row (i.e., PK) (but to paraphrase something I saw the other day, ... in
theory, there should be no difference between theory and practice, but in
practice, theory and practice don't match up...)

JOPO (just one person's opinion)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Douglas J. Steele

You're teaching good habits (although you'll get a very heated debate as to
whether you should always use autonumbers, or a natural key)
 
T

Tim Ferguson

but I thought every table should
have a primary key, no matter how minor the table.

If it doesn't have a primary key, it's not a table.

In practical terms, what method is currently being used to identify which
row of a "minor" table is to be looked-up? Whatever field or combination of
fields is being used - that is the primary key, whether you have bothered
to tell the db engine about it or not.

HTH


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top