I an old school and was taught the same way you were. Create a Customer# field and make it unique. I believe the recommendation on using a system generated identity column that would only ever been seen by an IT person is to protect against future business need changes. In 10 years what would you do if for some reason this table no longer could use the Customer# as unique. For some reason you had to allow for two records with the same Customer#. You would lose the unique key and would probably be forced to add a new field/column, like a sequence number, to keep a unique key. If you have an Identity field/column that issue goes away.
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Bob Cagle
Sent: Monday, August 28, 2017 12:13 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: Database design question
So, I'm a little late to the DDL party. Since I work on JD Edwards, I seldom have the need to create a new file. But, working on one now.
I'm not wanting to start a religious argument here, but I'm afraid this is going to...
So I've read up on DDL and came across some recommendations for best practices for database design. These two points specifically are what I'm questioning:
. Every table should have a primary key. The Primary Key should be an identity column, NOT business data . Create business key as unique from business data, not Primary Key
I'm creating a simple Customer address file: Last Name, First Name, Address, City, State, Zip. So I've created an auto-incrementing identity field as id.
In my mind, the id should also be unique, but the recommendation is to only use business data. What's the point of having a Primary Key separate from a Unique key? In the past, I would've created a 'Customer#' field and incremented that field in the RPG. The Customer# field would be both unique and primary.
So to follow these best-practices, do I create the Customer# row in addition to id as identity and mark Customer# as Unique?
If so, then can I set Customer# to auto-increment without marking it as identity, or do I still handle the incrementing in the program?
Or do I forgo the Customer# row entirely and define the Unique Key from the rest of the fields? I would basically have to include every field in order to make it unique.
I'm open to suggestions/discussion?
Thanks
Bob Cagle
IT Manager
Lynk
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
________________________________
This email may contain confidential information about a Pennsylvania College of Technology student. It is intended solely for the use of the recipient. This email may contain information that is considered an “educational record” subject to the protections of the Family Educational Rights and Privacy Act Regulations. The regulations may be found at 34 C.F.R. Part 99 for your reference. The recipient may only use or disclose the information in accordance with the requirements of the Federal Educational Rights and Privacy Act Regulations. If you have received this transmission in error, please notify the sender immediately and permanently delete the email.
As an Amazon Associate we earn from qualifying purchases.