Possible Duplicate:
Primary key/foreign Key naming convention

What's the naming convention for Primary Key column in Db Tables?

For example: PK_Country or CountryId or ID or PrimaryKey or.. ?

Posts ought to be named in line with the data elements they represent, not according to what constraints affect them. A principal key column ought to be named in the same manner you title every other column. The ISO 11179 has some helpful recommendations for naming data elements.

When the table is known as Test I'd call the PK column TestID.

That's virtually as much as the designer from the db. After I get it done I result in the area title from the primary key: id and area title of foreign secrets: tablenameId

I usually attempt to start primary secrets with PK and foriegn secrets with FK. Also, when naming foriegn secrets, I attempt to incorporate the table names and column names within the title from the foriegn key: FK_Questions-test-id_Tests-seq-num will be a foriegn key from table inquiries to table tests where questinos.test_id = tests.seq_num. it helps you to title them this way for when you're glancing at the secrets.

There really isn't a defined standard rather, you need to develop your personal convention and make certain that each primary key you define is in line with that convention.

I love the Ruby on Rails conventions:

  • primary type in any table is auto-increment integer column known as id
  • foreign secrets are named as foreign table title plus _id. Example:
    • country_id is really a foreign key that matches an archive in the countries table

for which its worth here's Oracle's answer :

Primary Key Fields - indicate by appending _pk

e.g.

PATIENTS might have a principal key known as pa_patient_id_pk

REGIONS might have a principal key known as re_region_id_pk

And so forth...the title from the primary key area as being a singular version on the table title. Other tables that contains this like a foreign key would omit the _PK

so CLINIC_ATTENDANCE might then possess a foreign key known as ca_patient_id or else: ca_patient_id_fk

Tables with Compound PK's, use _ck instead of _pk

Observe that where several tables make use of the same PK included in a substance foreign key then your only unique area of the FK fieldname would be the table prefix.

Link as asked for is http://ss64.com/ora/syntax-naming.html