473,288 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

When is it a look up table and when is it an real entity?

That subject line will have Joe Celko apoplectic!!

Let's say I have this thing. Oh, I don't know, a car. No, a vehicle. Can we
agree that is an entity type?
Some attributes might be VIN, Fuel, Color.
Some entity instances might be:
wvv2939-32-2993-2-90, Gasoline, Blue
wvv3942-3249--2830-2, Diesel, Red

I wanna make it easy to get the colors in. Keep a list of 'em somewhere. So
is that an entity that has a many to one relationship to vehicle? Or do I
just have a standalone table somewhere with a list of colours, grab one when
I want it and shove it into the right vehicle field.

Which approach best? How to decide.

Yours, Em


Nov 13 '05 #1
2 1532
Well, here are some things you could think about as you consider this
decision:

Do you want to force users to select one of the colors in the table?
Or can they type one in that doesn't match anything?

Assuming you're letting users use something not in the table -
are new entries added to the table?

What if an entry in the table changes?
(just as a "for instance", a manufacturer decides to rename his existing
color "blue" to "deep blue" because he's also introducing a "pale blue".)
Do you want all of the existing cars which are labelled "blue" to now
become "deep blue"?

If you define a relationship and enforce referential integrity, all colors
used must be in the table (but you can leave the field blank).
To add a color, you must add it to the table.
If you add cascade updates to your referential integrity, a change in the
colors table will propagate into your vehicles table.
Also (this doesn't apply to any of the questions above) if you add cascade
deletes to your referential integrity, removing the color "red" from your
colors table will remove all red cars from the vehicles table.

So, you see, it pretty much depends on how you want your application to
work.

HTH
- Turtle

"Emily Jones" <em************@hotmail.com> wrote in message
news:40***********************@news.aaisp.net.uk.. .
That subject line will have Joe Celko apoplectic!!

Let's say I have this thing. Oh, I don't know, a car. No, a vehicle. Can we agree that is an entity type?
Some attributes might be VIN, Fuel, Color.
Some entity instances might be:
wvv2939-32-2993-2-90, Gasoline, Blue
wvv3942-3249--2830-2, Diesel, Red

I wanna make it easy to get the colors in. Keep a list of 'em somewhere. So is that an entity that has a many to one relationship to vehicle? Or do I
just have a standalone table somewhere with a list of colours, grab one when I want it and shove it into the right vehicle field.

Which approach best? How to decide.

Yours, Em

Nov 13 '05 #2
Emily -

Well in 20 years of data modeling I have decided it is appropriate to show
'Color' as an entity in the model with a one-to-many relationship to 'Car'. Even
though the primary reason for its existence is only to translate codes into
their corresponding descriptions. Which implies I guess that it is also used to
validate user input.

I even made up a name for these special model objects: 'entribute'. Not exactly
an entity, but something more than just an attribute. Formal modeling theory
might have some official name for them?

Showing entributes in the model means that they should be documented just like
any other entity - always a good thing, especially for application-specific
things like 'Employee Type'. Also simplifies the process of forward-engineering
the database if you are using something like ERwin.

Of course having all these extra objects complicates the diagram somewhat. If
the diagram is large, I will produce two versions: one showing all the entities
and another showing just the base entities without the entributes.

Sometimes I think that there really is no such thing as a 'lookup table'. An
application may start off with a State table for validating State Codes, but
over time the table may evolve to include other things (Population, Number of
Counties), and at some point it will cross the fuzzy line dividing lookup tables
from 'real tables'.

HTH.

- Brian

On Mon, 07 Jun 2004 00:21:59 GMT, "MacDermott" <ma********@nospam.com> wrote:
Well, here are some things you could think about as you consider this
decision:

Do you want to force users to select one of the colors in the table?
Or can they type one in that doesn't match anything?

Assuming you're letting users use something not in the table -
are new entries added to the table?

What if an entry in the table changes?
(just as a "for instance", a manufacturer decides to rename his existing
color "blue" to "deep blue" because he's also introducing a "pale blue".)
Do you want all of the existing cars which are labelled "blue" to now
become "deep blue"?

If you define a relationship and enforce referential integrity, all colors
used must be in the table (but you can leave the field blank).
To add a color, you must add it to the table.
If you add cascade updates to your referential integrity, a change in the
colors table will propagate into your vehicles table.
Also (this doesn't apply to any of the questions above) if you add cascade
deletes to your referential integrity, removing the color "red" from your
colors table will remove all red cars from the vehicles table.

So, you see, it pretty much depends on how you want your application to
work.

HTH
- Turtle

"Emily Jones" <em************@hotmail.com> wrote in message
news:40***********************@news.aaisp.net.uk. ..
That subject line will have Joe Celko apoplectic!!

Let's say I have this thing. Oh, I don't know, a car. No, a vehicle. Can

we
agree that is an entity type?
Some attributes might be VIN, Fuel, Color.
Some entity instances might be:
wvv2939-32-2993-2-90, Gasoline, Blue
wvv3942-3249--2830-2, Diesel, Red

I wanna make it easy to get the colors in. Keep a list of 'em somewhere.

So
is that an entity that has a many to one relationship to vehicle? Or do I
just have a standalone table somewhere with a list of colours, grab one

when
I want it and shove it into the right vehicle field.

Which approach best? How to decide.

Yours, Em


Nov 13 '05 #3

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

Similar topics

36
by: toedipper | last post by:
Hello, I am designing a table of vehicle types, nothing special, just a list of unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor etc etc For the table design I am...
20
by: Simon Harvey | last post by:
Festive greetings fellow programmers! I've been programming now for about 4, maybe 5 years now. 4 of those years were at university so and I havent had much work experience of making real world...
2
by: JR | last post by:
I am attempting to display two list boxes. In the first list box is a listing of all entities. When a entity is selected and it has a subentity the second list box displays with a list of the...
9
by: Jukka K. Korpela | last post by:
I noticed that Internet Explorer (6.0, on Win XP SP 2, all fixes installed) incorrectly renders e.g. &harr &euro &Omega literally and not as characters denoted by the entities, but if a semicolon...
3
by: Jan Szymczuk | last post by:
I am trying to create a query that will show me who is phoning who in an organisation from available Telephone Billing information. I am creating a MSAccess 2000 database with a few few tables, two...
2
by: TJ Talluto | last post by:
Instead of putting the same 12 columns on every table (these 12 columns contain info about who created the record and when, for example)... It may be more efficient to make a new table to hold that...
1
by: travismorien | last post by:
I have four tables of different "entities". One table contains information for "people", one for "trusts", one for "companies" and one for "self managed super funds". Each type of entity has an...
16
by: pukivruki | last post by:
hi, I wish to create a temporary table who's name is dynamic based on the argument. ALTER PROCEDURE . @PID1 VARCHAR(50), @PID2 VARCHAR(50), @TICKET VARCHAR(20)
2
by: cjard | last post by:
Suppose: A TextBox is bound to a BindingSource, which is bound to a DataTable A BindingNavigator is used to alter the current row being looked at by the BindingSource (i.e. Nav's NEXT button is...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.