What Tim said :)

This is basically how I name columns.. primary key is identified, not by 
some generic name like "id" but by the name I'd use for it in the foreign 
key reference.


>From: "Tim Sawmiller" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
>Subject: RE: opinions on naming primary keys in new database
>Date: Thu, 08 Mar 2001 09:11:05 -0800
>
>I like leaving prefixes off the column names, except for primary keys.  
>There I used the table short name, or alias, followed by 'id.  So for the 
>CUSTOMER table, I'd use CUST_ID.  This same column name would be used in 
>child tables as the FK reference.
>
> >>> [EMAIL PROTECTED] 03/08/01 11:47AM >>>
>I agree with Hugh's approach.  I don't like redundancy (a fully-qualified
>reference to a column describes it fully), nor embedding the object type
>name in an object name (e.g., "data_tablespace").  IMHO, too few developers
>and DBA's give enough thought to the names they give their database 
>objects.
>
>
>Paul Baumgartel
>InstiPro, Inc.
>[EMAIL PROTECTED]
>212 813-0829 x103 (office)
>917 549-4717         (mobile)
>
>
>-----Original Message-----
>Sent: Thursday, March 08, 2001 11:11 AM
>To: Multiple recipients of list ORACLE-L
>
>
>Hugh,
>
>You are right that Richard Barker says not to use an entity name as part of
>an attribute name.  (CASE*METHOD Entity Relationship Moddelling, by Richard
>Barker, page 3-9)  And I believe Oracle still gives out this book in their
>Data Modeling class.
>
>I have seen databases that completely follow this method and others that
>include the table name in every column.  As far as naming your primary key
>as a column called 'key', I don't like it either.
>
>I am also curious to see what is the preference of other list members.
>
>
>Regards,
>
>Jeff Cox
>IPS-Sendero
>Scottsdale, AZ
>
>
>
>
>-----Original Message-----
>Sent: Wednesday, March 07, 2001 4:58 PM
>To: [EMAIL PROTECTED]
>
>
>Hello,
>
>I wanted to get the lists opinion on the preference of naming primary keys.
>
>Please see my example below with the CUSTOMER table, and the customer TYPE
>table.  The column 'type_id' is a foreign key referencing the TYPE table.
>This is just an example to get opinions.
>
>
>CUST               TYPE
>+---------+       +------+
>| id      |       |id    |
>| name    |       |desc  |
>| type_id |>------|      |
>+---------+       +------+
>
>
>I like having my primary keys called id, and not including the table names
>in the columns of the original table.  For example, in the CUST table, we
>would not have 'cust_id' as the primary key, we would just call it 'id'.
>But having 'type_id' as a column of the CUST table is okay because that is 
>a
>foreign key, and not an attribute of the original CUST entity.
>
>Including the table name in a column that is not a foreign key, I believe,
>is redundant and not necessary.  (I also remember reading this in a Richard
>Barker book.)
>
>All foreign keys would then have the standard of table_column, with the
>exception of tables with multiple foreign keys from the same table, and
>recursive relationships - which would then just include a more descriptive
>table_column name.
>
>This way, when you do a describe on a table, you will immediately be able 
>to
>tell what are the foreign keys, and the primary keys. (I also believe in
>surrogate keys for most tables, so the problem of having a composite key is
>not an issue here.)  I think that this will later make the database easier
>to understand to new DBAs and duhvelopers, which would have been nice when 
>I
>worked on my first database.
>
>My questions:
>
>1) What is your preference with primary and foreign keys - if you could
>design a database from scratch?
>
>2) Am I off my rocker thinking that this is a good way to design a 
>database?
>
>3) We have a developer who wants to name all of our primary keys, 'key', 
>and
>I am trying to convince her that we should use 'id' or 'nbr' instead.  Has
>anyone ever used 'key' as the primary key of a table?  This seems like it
>would be confusing when
>
>All constructive criticism is welcomed.
>
>Thank you,
>
>Hugh
>
>
>
>--------
>Think you know someone who can answer the above question? Forward it to
>them!
>to unsubscribe, send a blank email to [EMAIL PROTECTED]
>to subscribe send a blank email to [EMAIL PROTECTED]
>Visit the list archive: http://www.LAZYDBA.com/odbareadmail.pl
>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: Jeff Cox
>   INET: [EMAIL PROTECTED]
>
>Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
>San Diego, California        -- Public Internet access / Mailing Lists
>--------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from).  You may
>also send the HELP command for other information (like subscribing).
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: Paul Baumgartel
>   INET: [EMAIL PROTECTED]
>
>Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
>San Diego, California        -- Public Internet access / Mailing Lists
>--------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from).  You may
>also send the HELP command for other information (like subscribing).
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: Tim Sawmiller
>   INET: [EMAIL PROTECTED]
>
>Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
>San Diego, California        -- Public Internet access / Mailing Lists
>--------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from).  You may
>also send the HELP command for other information (like subscribing).

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rachel Carmichael
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to