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  

Table design question



 
 
Thread Tools Display Modes
  #1  
Old May 12th, 2010, 07:41 PM posted to microsoft.public.access.tablesdbdesign
Mark
external usenet poster
 
Posts: 1,534
Default Table design question

Hi All,

I just wanted to see if the design of some fields in the table are standard
practice.

The database admin set up a Code_Desc table with fields Code_Type_ID,
Code_Value and Code_Desc

Code_Desc
Code_Type_ID, Code_Value, Code_Desc
1 1 Emp Status - Active
1 2 Emp Status - Inactive
2 1 Emp Type - Associate
2 2 Emp Type - Manager
2 3 Emp Type - Auditor
3 1 Error Type - Major
3 2 Error Type - Minor
4 1 Shift - 1st
4 2 Shift - 2nd
etc...

However in tables that use these values she is wanting the Code_Type_ID and
Code_Value combined.

Example:
Audit_History (table)
Shift, Error_ID, Emp_Type (fields)
41 32 21 (combined)

Is this standard? Is this the best approach? To me it adds coding by having
to combine everything, but it also makes it hard for others to run queries on
the Db that have limited query skills. Do you see other pitfalls besides the
one I see?

What is the best way to combine it as well, concatenation?
  #2  
Old May 12th, 2010, 08:50 PM posted to microsoft.public.access.tablesdbdesign
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Table design question

It seems to me that the problem is the Code_Desc not having a single field
primary key (unless it's the Code_Desc field and that brings up a bunch of
other problems).

Also the Code_Desc being the name of both the table and a field could cause
problems. The table should be named something like Code_Descs which is plural
as that's where the Code_Desc are stored.

But I digress. I'd put an autonumber PK field on Code_Desc table and store
that number in the Error_ID field of the Audit_History table instead of the
combination of the two fields.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Mark" wrote:

Hi All,

I just wanted to see if the design of some fields in the table are standard
practice.

The database admin set up a Code_Desc table with fields Code_Type_ID,
Code_Value and Code_Desc

Code_Desc
Code_Type_ID, Code_Value, Code_Desc
1 1 Emp Status - Active
1 2 Emp Status - Inactive
2 1 Emp Type - Associate
2 2 Emp Type - Manager
2 3 Emp Type - Auditor
3 1 Error Type - Major
3 2 Error Type - Minor
4 1 Shift - 1st
4 2 Shift - 2nd
etc...

However in tables that use these values she is wanting the Code_Type_ID and
Code_Value combined.

Example:
Audit_History (table)
Shift, Error_ID, Emp_Type (fields)
41 32 21 (combined)

Is this standard? Is this the best approach? To me it adds coding by having
to combine everything, but it also makes it hard for others to run queries on
the Db that have limited query skills. Do you see other pitfalls besides the
one I see?

What is the best way to combine it as well, concatenation?

  #3  
Old May 12th, 2010, 08:54 PM posted to microsoft.public.access.tablesdbdesign
xps35
external usenet poster
 
Posts: 22
Default Table design question

=?Utf-8?B?TWFyaw==?= wrote:


Hi All,

I just wanted to see if the design of some fields in the table are standard
practice.

The database admin set up a Code_Desc table with fields Code_Type_ID,
Code_Value and Code_Desc

Code_Desc
Code_Type_ID, Code_Value, Code_Desc
1 1 Emp Status - Active
1 2 Emp Status - Inactive
2 1 Emp Type - Associate
2 2 Emp Type - Manager
2 3 Emp Type - Auditor
3 1 Error Type - Major
3 2 Error Type - Minor
4 1 Shift - 1st
4 2 Shift - 2nd
etc...

However in tables that use these values she is wanting the Code_Type_ID and
Code_Value combined.

Example:
Audit_History (table)
Shift, Error_ID, Emp_Type (fields)
41 32 21 (combined)

Is this standard? Is this the best approach? To me it adds coding by having
to combine everything, but it also makes it hard for others to run queries on
the Db that have limited query skills. Do you see other pitfalls besides the
one I see?

What is the best way to combine it as well, concatenation?


I do not consider this as standard. A more standard approach would be to
create a table for each type of code (Emp Status, Emp Type, Error Type,
Shift).
In that way you can refer to a specific table when using a specific code
in a table.
Besides that, in the current design you store the meaning of
Code_Type_ID multiple times which is a sign of poor design.

--
Groeten,

Peter
http://access.xps350.com

 




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 11:20 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.