473,405 Members | 2,373 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,405 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 1537
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...
0
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,...

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.