473,605 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Database normalization question

I've heard it's best to have a meaningless primary key (such as an
autonumber field) as opposed to a pk that contains volatile data. This
sounds reasonable enough. In fact, I think I'd need a good reason *not* to
use an autonumber field for a pk. But how do I normalize with an autonumber
pk? My guess is I pick a field to use as a "pseudo pk" when defining
dependencies.

Let's say I follow the single field, autonumber pk philosophy. I'll never
have a composite pk and thus won't be concerned with 2NF, but will be
concerned with columns that are not dependant upon the pk (or rather the
"pseudo pk") for 3NF normalization.

If I have an "Accounts" table, for example, I might have an AcctNumber
(Long) field and an Acct_ID (Autonumber) pk field. The Acct_ID is
meaningless, so I'd have to ask, "What data is this table designed to
store?" - easy enough: Account numbers. So when adding new fields I
normalize to the AcctNumber field (whether it's indexed or not). This means
fields like Account Type and Creation Date might be added to the table, but
Customer Name and Telephone Number would go in a separate table.

Does this sound about right?

Thanks in advance for your comments.
Nov 13 '05 #1
5 2227

deko wrote:
I've heard it's best to have a meaningless primary key (such as an
autonumber field) as opposed to a pk that contains volatile data. This sounds reasonable enough. In fact, I think I'd need a good reason *not* to use an autonumber field for a pk. But how do I normalize with an autonumber pk? My guess is I pick a field to use as a "pseudo pk" when defining
dependencies.

Let's say I follow the single field, autonumber pk philosophy. I'll never have a composite pk and thus won't be concerned with 2NF, but will be
concerned with columns that are not dependant upon the pk (or rather the "pseudo pk") for 3NF normalization.

If I have an "Accounts" table, for example, I might have an AcctNumber (Long) field and an Acct_ID (Autonumber) pk field. The Acct_ID is
meaningless, so I'd have to ask, "What data is this table designed to
store?" - easy enough: Account numbers. So when adding new fields I
normalize to the AcctNumber field (whether it's indexed or not). This means fields like Account Type and Creation Date might be added to the table, but Customer Name and Telephone Number would go in a separate table.

Does this sound about right?

Thanks in advance for your comments.


Nov 13 '05 #2
rkc
deko wrote:
I've heard it's best to have a meaningless primary key (such as an
autonumber field) as opposed to a pk that contains volatile data. This
sounds reasonable enough. In fact, I think I'd need a good reason *not* to
use an autonumber field for a pk. But how do I normalize with an autonumber
pk? My guess is I pick a field to use as a "pseudo pk" when defining
dependencies.

Let's say I follow the single field, autonumber pk philosophy. I'll never
have a composite pk and thus won't be concerned with 2NF, but will be
concerned with columns that are not dependant upon the pk (or rather the
"pseudo pk") for 3NF normalization.

If I have an "Accounts" table, for example, I might have an AcctNumber
(Long) field and an Acct_ID (Autonumber) pk field. The Acct_ID is
meaningless, so I'd have to ask, "What data is this table designed to
store?" - easy enough: Account numbers. So when adding new fields I
normalize to the AcctNumber field (whether it's indexed or not). This means
fields like Account Type and Creation Date might be added to the table, but
Customer Name and Telephone Number would go in a separate table.

Does this sound about right?


Sounds exactly right. The AcctNumber identifies the Account relation.
Everything in the Account relation should be dependent on the AcctNumber.

The Acct_ID autonumber is thrown in, not really as part of the
Account relation, but as a device to uniquely identify a physical
record stored by the database system.


Nov 13 '05 #3
> > Does this sound about right?

Sounds exactly right. The AcctNumber identifies the Account relation.
I assume you're using the term relation in a generic sense - i.e. if I have
an Accounts table and a Transactions table you're *not* saying a
relationship should be established using the AcctNumber field.
Everything in the Account relation should be dependent on the AcctNumber.
Do you mean everything in the Accounts *table* should be dependent on the
AcctNumber?
What do you mean by "Account relation"?
The Acct_ID autonumber is thrown in, not really as part of the
Account relation, but as a device to uniquely identify a physical
record stored by the database system.


Yes, and relationships between tables (e.g. between Accounts and
Transactions) are built using the tblAccounts.Acc t_ID (one) and the foreign
key tblTransactions .Acct_ID (many).

As an aside, a foreign key is simply a field that is the "many" side of a
one-to-many relationship - is this correct?
Nov 13 '05 #4
rkc

deko wrote:
Does this sound about right?


Sounds exactly right. The AcctNumber identifies the Account relation.

I assume you're using the term relation in a generic sense - i.e. if I have
an Accounts table and a Transactions table you're *not* saying a
relationship should be established using the AcctNumber field.


Right again. A relation is what more or less becomes the structure of a
normalized table.

Everything in the Account relation should be dependent on the AcctNumber.

Do you mean everything in the Accounts *table* should be dependent on the
AcctNumber?
What do you mean by "Account relation"?


O.K. Just substitute table for relation. When you are deciding what
belongs in an Accounts table you don't decide that based on the fact
that an autonumber will identify the physical row in the database.
The concept of an Account does not include an autonumber that no
human will ever see. It includes an Account number that they will.
A bank check does not have the autonumber generated by the database
being used printed on it. You don't have to write your account
autonumber on the back of a third party check in order to cash it.
Account type is in the table because it denotes the type of account
AcctNumber identifies. Creation Date is in the table because it
establishes when the account identfied by AcctNumber was created.
The primary key of the Customer table is in the table because it
establishes a relationship to the customer that owns the account
identfied by AcctNumber.
The Acct_ID autonumber is thrown in, not really as part of the
Account relation, but as a device to uniquely identify a physical
record stored by the database system.

Yes, and relationships between tables (e.g. between Accounts and
Transactions) are built using the tblAccounts.Acc t_ID (one) and the foreign
key tblTransactions .Acct_ID (many).


Right again. If you have decided to buy into the theory that all tables
that are going to be related to other tables should have an autonumber
primary key.

Nov 13 '05 #5
> >>>Does this sound about right?

Sounds exactly right. The AcctNumber identifies the Account relation.

I assume you're using the term relation in a generic sense - i.e. if I have
an Accounts table and a Transactions table you're *not* saying a
relationship should be established using the AcctNumber field.


Right again. A relation is what more or less becomes the structure of a
normalized table.

Everything in the Account relation should be dependent on the
AcctNumber.


Do you mean everything in the Accounts *table* should be dependent on the AcctNumber?
What do you mean by "Account relation"?


O.K. Just substitute table for relation. When you are deciding what
belongs in an Accounts table you don't decide that based on the fact
that an autonumber will identify the physical row in the database.
The concept of an Account does not include an autonumber that no
human will ever see. It includes an Account number that they will.
A bank check does not have the autonumber generated by the database
being used printed on it. You don't have to write your account
autonumber on the back of a third party check in order to cash it.
Account type is in the table because it denotes the type of account
AcctNumber identifies. Creation Date is in the table because it
establishes when the account identfied by AcctNumber was created.
The primary key of the Customer table is in the table because it
establishes a relationship to the customer that owns the account
identfied by AcctNumber.
The Acct_ID autonumber is thrown in, not really as part of the
Account relation, but as a device to uniquely identify a physical
record stored by the database system.

Yes, and relationships between tables (e.g. between Accounts and
Transactions) are built using the tblAccounts.Acc t_ID (one) and the foreign key tblTransactions .Acct_ID (many).


Right again. If you have decided to buy into the theory that all tables
that are going to be related to other tables should have an autonumber
primary key.


Sounds good. Thanks for the feedback!
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2314
by: SuryaPrakash Patel via SQLMonster.com | last post by:
Dear All, How to reach to the highest level of normalization for database designing? Guide Lines Needed. What will be the characteristics of a database of a completely normalized databae? Check List needed.
7
1696
by: Adrian | last post by:
Normalization Question - Please bear with me, hopefully things will be clear at the end of the question. Given a treaty table containg treaties; Treaty1, Treaty2 etc and a benefit table; Benefit1, Benefit2 etc. A treaty can only have certain benefits:- For example Treaty 1 can process Benefit1 and Benefit2. To maintain this relationship a new table TreatyBenefit has been
7
2451
by: John Welch | last post by:
I have three tables and the way they are currently set up violates good normalization, but I'm having trouble figuring out a better way. Can someone suggest a more elegant solution? My tables are: tblCompanies: CompanyID - PK other fields like address, type of business, etc
29
3559
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this one data field - but i'm not sure) :-) Background info:
8
6630
by: Richard Hollenbeck | last post by:
I have a recipe database that I've been building but I haven't yet put any of the ingredients in because of a little problem of normalization. If I build a table of ingredients, all the recipes will have one or more ingredient(s), but no set number of ingredients, so that doesn't seem possible to normalize it. Any given recipe would use one, some, or all of the ingredients within the ingredients table, so I can't imagine an indefinite...
6
2893
by: No Spam Man | last post by:
Hi, I am not a programmer and in the past have only created very simple, flat file databases. Although I'm a newbie, I think I could probably figure out basic Boolean logic and financial functions. The database I want to create would import quite a few records -- maybe as many as 100,000. I would be importing them from an Internet source (comma delimited) to my desktop so that I could manipulate the data how I wanted. Despite the...
1
2962
pbmods
by: pbmods | last post by:
Heya. I'm adding features to a pre-existing project, and I was curious about the way I've been going about designing my database additions. My methodology is to keep my stuff separate from the other guy's stuff as much as possible. That way, I know that if it breaks, it is definitely my code's fault (or at least, 85% of the time it is... who HIRES these people?!). Likewise, on the database side, there's a pre-existing CMS in there, and...
1
2017
by: weird0 | last post by:
I know that is not the appropriate group for asking this question, but I do not know of any better forum. Can anyone plz explain clearly what normalization is? The first three normal forms upto 3NF and BCNF. I know the first one but the remaining ones are really confusing. The language changes dramatically into functional dependencies x---y, all that, and normalization, the real topic is lost in between. Decent explanation or good...
4
4357
by: Shravani | last post by:
I've been assigned a task to carry out the following exercise using C code: Functional Dependencies & Normalization: a. Specifying & testing Functional Dependencies on a relation b. Normalization based on Functional Dependencies c. Testing for lossless decomposition d. Testing for dependency preservation For this I've taken a books database that consists of the following
4
2874
by: FooFighter | last post by:
I was going to make a database to store a list of my DVD's. I have a question about the table structure though. I want to have some fields for actors. I'm thinking 4 or 5 would be plenty. From what I understand it wouldn't be proper to have fields like Actor1 Actor2 and so on. As I would want to be able to search for a movie based on an actor, how would I structure my tables for this and keep things normalized? I was thinking perhaps another...
0
8418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8288
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3912
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1541
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.