A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Numberic Field for Lookup



 
 
Thread Tools Display Modes
  #1  
Old November 20th, 2008, 03:58 AM posted to microsoft.public.access.tablesdbdesign
Rita
external usenet poster
 
Posts: 196
Default Numberic Field for Lookup

I designed a huge database 10 years ago. I finally am going back and cleaning
things up. There are several tables that I used a text field as a primary
field. I would like to delete the relationships, create an autonumber field
for each table, and recreate the relationships. I have 147 queries though so
it would be a lot of work. Everything works, so would the database run better
using a numberic field? Thanks!
  #2  
Old November 20th, 2008, 04:39 AM posted to microsoft.public.access.tablesdbdesign
Allen Browne
external usenet poster
 
Posts: 11,706
Default Numberic Field for Lookup

For tables where there is a simple, obvious, short, natural primary key, use
it.

For example, if you have a table of categories where each category name is
unique, required, and say 24 characters or less, it makes good sense to use
the category name as the primary key IMHO. IME, there is no practical
difference in performance when using a text-key for these little tables with
1000 records.

Some developers avoid this because they have generic routines that assume a
particular data type. You do have to remember to add the quote delimters
when matching a value in a text field.

Sometimes the text primary key is really handy, e.g. it avoids some problems
Access has when a combo's bound column is not the display problem:
http://allenbrowne.com/bug-06.html

So, I'm not convinced it would be worth the effort to change them all.

If you do have problems in remembering the data types and sizes for all the
fields in your projects, here's what I use:
Relationship Report with extended field information
at:
http://allenbrowne.com/AppRelReport.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rita" wrote in message
...
I designed a huge database 10 years ago. I finally am going back and
cleaning
things up. There are several tables that I used a text field as a primary
field. I would like to delete the relationships, create an autonumber
field
for each table, and recreate the relationships. I have 147 queries though
so
it would be a lot of work. Everything works, so would the database run
better
using a numberic field? Thanks!


  #3  
Old November 20th, 2008, 01:11 PM posted to microsoft.public.access.tablesdbdesign
Rita
external usenet poster
 
Posts: 196
Default Numberic Field for Lookup

Well that's good to hear! I thought the database ran more efficient if the
foreign keys were numeric. Thanks so much for the Relationship Report with
extended field information!!!! What a wonderful tool!


"Allen Browne" wrote:

For tables where there is a simple, obvious, short, natural primary key, use
it.

For example, if you have a table of categories where each category name is
unique, required, and say 24 characters or less, it makes good sense to use
the category name as the primary key IMHO. IME, there is no practical
difference in performance when using a text-key for these little tables with
1000 records.

Some developers avoid this because they have generic routines that assume a
particular data type. You do have to remember to add the quote delimters
when matching a value in a text field.

Sometimes the text primary key is really handy, e.g. it avoids some problems
Access has when a combo's bound column is not the display problem:
http://allenbrowne.com/bug-06.html

So, I'm not convinced it would be worth the effort to change them all.

If you do have problems in remembering the data types and sizes for all the
fields in your projects, here's what I use:
Relationship Report with extended field information
at:
http://allenbrowne.com/AppRelReport.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rita" wrote in message
...
I designed a huge database 10 years ago. I finally am going back and
cleaning
things up. There are several tables that I used a text field as a primary
field. I would like to delete the relationships, create an autonumber
field
for each table, and recreate the relationships. I have 147 queries though
so
it would be a lot of work. Everything works, so would the database run
better
using a numberic field? Thanks!



  #4  
Old November 20th, 2008, 07:18 PM posted to microsoft.public.access.tablesdbdesign
Roger Carlson
external usenet poster
 
Posts: 824
Default Numberic Field for Lookup

Well, in theory, it is true that joins based on numeric fields are more
efficient. However, if the difference is milliseconds, the practical
difference to the user is negligible. My experience is that small databases
sometimes become large, and so I develop for the future. But if your users
aren't bothered by the difference, it's probably not worth it to backfill,
IMO. On the other hand, if performance is an issue, that might be one way
to improve it.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L



"Rita" wrote in message
...
Well that's good to hear! I thought the database ran more efficient if the
foreign keys were numeric. Thanks so much for the Relationship Report with
extended field information!!!! What a wonderful tool!


"Allen Browne" wrote:

For tables where there is a simple, obvious, short, natural primary key,
use
it.

For example, if you have a table of categories where each category name
is
unique, required, and say 24 characters or less, it makes good sense to
use
the category name as the primary key IMHO. IME, there is no practical
difference in performance when using a text-key for these little tables
with
1000 records.

Some developers avoid this because they have generic routines that assume
a
particular data type. You do have to remember to add the quote delimters
when matching a value in a text field.

Sometimes the text primary key is really handy, e.g. it avoids some
problems
Access has when a combo's bound column is not the display problem:
http://allenbrowne.com/bug-06.html

So, I'm not convinced it would be worth the effort to change them all.

If you do have problems in remembering the data types and sizes for all
the
fields in your projects, here's what I use:
Relationship Report with extended field information
at:
http://allenbrowne.com/AppRelReport.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rita" wrote in message
...
I designed a huge database 10 years ago. I finally am going back and
cleaning
things up. There are several tables that I used a text field as a
primary
field. I would like to delete the relationships, create an autonumber
field
for each table, and recreate the relationships. I have 147 queries
though
so
it would be a lot of work. Everything works, so would the database run
better
using a numberic field? Thanks!





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.