Re: Choosing Primary and Foreign Keys

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: tina (nospam_at_address.com)
Date: 05/23/04


Date: Sun, 23 May 2004 20:12:36 GMT

personally, i never include a table name within a field name, too long and
confusing. i wouldn't want to have to type a name that long and hard to read
again and again - in code, in expressions, etc.
also, the most important element in using any naming convention, in any one
database, is consistency. if i used fktblShopsShopID for one foreign key
field, then i should use the same combination of "parts" for all foreign key
fieldnames in my database. the could lead to even longer, yuckier names.
to any developer who does a quick review of the table names, it's going to
be pretty apparent that fkShopID "probably" refers back to tblShops. that's
the important thing. you want clarity and consistency for yourself as a
developer (who may come back to the database 6 months later, not remembering
anything about it!). and just as importantly, for your customer, you want
some degree of clarity and consistency to help the *next* developer make
heads-or-tails of your design.
but you can name your tables and fields anything you want. naming
conventions are guidelines, not laws. :)

"rkc" <rkc@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:Ip1sc.240685$M3.56694@twister.nyroc.rr.com...
>
> "tina" <nospam@address.com> wrote in message
> news:bTUrc.49484$hH.939413@bgtnsc04-news.ops.worldnet.att.net...
> > see the suggested tables below. note the standardized table and field
> names,
> > most importantly *removing the spaces in the names*. see the following
> link
> > for further info:
> > http://www.mvps.org/access/tencommandments.htm
> > btw, these tables are not fully normalized. i would probably break
> > tblPurchases into two tables, but i would have to know more about the
> > process the database is supporting before i would make a specific
> > recommendation.
> >
> > tblShops:
> > ShopID (primary key)
> > ShopName
> > ShopStreet
> > ShopCity
> > ShopState
> > ShopZip
> >
> > tblPurchases:
> > PurID (primary key)
> > fkShopID (foreign key from tblShops)
>
> <snip>
>
> Why not fktblShopsShopID?
>
>



Relevant Pages

  • Re: When MV is not an option
    ... All of his reports ended up on Excel. ... >> He didn't like his data out of synch with the live database, ... but that as soon as you tell a Pick developer that there are ... >>I don't know what google is doing with base.google.com but I'm sure it ...
    (comp.databases.pick)
  • Re: 3vl 2vl and NULL
    ... > or API to the stored data is of primarily interest to me. ... >> designers are capable of defining the world for application programmers, ... I am more of an end-user (aka developer) looking to those ... But building an enterprise database is a lot more than succeeding at a lot ...
    (comp.databases.theory)
  • Re: Senior Developer looking for your asst in employmt issue (not job seeking!)
    ... manager hat, you must manage expectations. ... Wish I could see the actual database to answer your ... > I am dealing with a tough employment issue in which a supervisor - who is ... > I've been working professionally as a developer since 1993. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Senior Developer looking for your asst in employmt issue (not job seeking!)
    ... manager hat, you must manage expectations. ... Wish I could see the actual database to answer your ... > I am dealing with a tough employment issue in which a supervisor - who is ... > I've been working professionally as a developer since 1993. ...
    (microsoft.public.vb.database)
  • Re: Senior Developer looking for your asst in employmt issue (not job seeking!)
    ... manager hat, you must manage expectations. ... Wish I could see the actual database to answer your ... > I am dealing with a tough employment issue in which a supervisor - who is ... > I've been working professionally as a developer since 1993. ...
    (microsoft.public.access.adp.sqlserver)