Which is better to use prefix -_pk or suffix _pk or none on column names

  • Thread starter Hoardling1 via AccessMonster.com
  • Start date
H

Hoardling1 via AccessMonster.com

Which is better to use prefix - pk or suffix -pk or none.
I honestly like using suffix of _pk, but if I had a reason to use the prefix
version I would. I would just like to know the benefits and hinderances of
why to use prefix, suffix or none.
Thanks
 
T

Tony Toews [MVP]

Hoardling1 via AccessMonster.com said:
Which is better to use prefix - pk or suffix -pk or none.
I honestly like using suffix of _pk, but if I had a reason to use the prefix
version I would. I would just like to know the benefits and hinderances of
why to use prefix, suffix or none.

I prefer using ID as a suffix but that's just my preference. I also
use that on foreign keys as well. I like using some kind of
convention for primary and foreign keys so it's easier to pick them
out.

Just to cloud the issue though see

Tony's Table and Field Naming Conventions
http://www.granite.ab.ca/access/tablefieldnaming.htm

Tony's Object Naming Conventions
http://www.granite.ab.ca/access/tonysobjectnamingconventions.htm

for how I do things.

Tony

--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
T

Tony Toews [MVP]

Hoardling1 via AccessMonster.com said:
Which is better to use prefix - pk or suffix -pk or none.
I honestly like using suffix of _pk, but if I had a reason to use the prefix
version I would. I would just like to know the benefits and hinderances of
why to use prefix, suffix or none.

P.S. This can be a religious war. <smile> This topic could die
quickly or be sustained for a month with hundreds of postings.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
M

Michael Gramelspacher

P.S. This can be a religious war. <smile> This topic could die
quickly or be sustained for a month with hundreds of postings.

Tony

Not to start another religious war, but maybe the OP can go with one of these.
Or maybe, perhaps, come up with still something different.

CREATE TABLE CustomerOrders
(customer_num VARCHAR (10) NOT NULL
REFERENCES Customers (customer_num),
order_num VARCHAR (10) NOT NULL
REFERENCES Orders (order_num),
PRIMARY KEY (customer_num, order_num));

CREATE TABLE tblCustomerOrders
(CustomerNum_pk VARCHAR (10) NOT NULL
REFERENCES tblCustomers (CustomerNum_pk),
OrderNum_pk VARCHAR (10) NOT NULL
REFERENCES tblOrders (OrderNum),
PRIMARY KEY (CustomerNum_pk, OrderNum_pk));
 
G

Guest

Tools, Options, Tables/Queries, "AutoIndex on Import/Create"

If the beginning (prefix) or ending (suffix) characters match one
of those terms, Access will automatically create an index on that
field (when you design view to create tables, not if you use
CREATE TABLE sql to create tables).

If you like having Access automatically create your indexes for
you, this is a benefit. If you like to have fields named ID_ or _ID,
or -pk or pk-, that are not keys, this is a hindrance.

Put your meat information where it feels comfortable for you.
If you are a C programmer, put it at the start. If you are a
BASIC programmer, use a suffix. If you are a Pascal programmer,
do not include meat-information in your field names.

In some situations, having all your fields start with repeated
characters is a hindrance or a benefit, because the prefix
defines the sort order. Other than that, put the most important
part of the name comes first.

Traditionally, BASIC used suffixes for type information, because
type information was of reduced importance in BASIC.

Pascal used names which expressed the contents of the
field, rather than the binary representation of the contents,
because the language was designed to handle type information
cleanly by definition and declaration.

FORTRAN and C used (and use) prefixes which express
the binary representation of the field because in C and FORTRAN,
(for different reasons) the data representation is the most important
and difficult content: the logical content of the field is of secondary
importance.

Just be consistent.

(david)
 
H

Hoardling1 via AccessMonster.com

Hoardling1 said:
Which is better to use prefix - pk or suffix -pk or none.
I honestly like using suffix of _pk, but if I had a reason to use the prefix
version I would. I would just like to know the benefits and hinderances of
why to use prefix, suffix or none.
Thanks


Thanks for all the replies guys, this is helpful to know exactly the details
of the suffix, prefix or none decisions.
 

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