views:

145

answers:

5

I just gave a database diagram for a DB I created to our head database person and she put a bunch of notes on it suggesting that I rename certain tables so it is clear they are lookup tables (add "lu" to the beginning of the table name).

My problem is that these don't fit the definition of what I consider a look up table to be. I have always considered a look up table to basically be a set of options that don't define any relationships. Example:

luCarMake
-----------
id    Make
--    ---------
1     Audi
2     Chevy
3     Ford

The database person at my work is suggesting that I rename several tables that are just IDs maping one table to another as lookup tables. Example (Location_QuadMap below):

Location
----------
LocationId
name
description

Location_QuadMap <-- suggesting i rename this to luLocationQuad
----------------
QuadMapId
LocationId

luQuadMap
---------
QuadMapId
QuadMapName

Is it safe to assume that she misread the diagram or is there another definition that I am not aware of?

+2  A: 

Some people use the term Lookup Table as the table that sits in the middle of a many to many relationship.

Justin Niessner
I usually hear the many-to-many table as a bridge table. And, Abe's definition for a lookup table. That's interesting.
bobs
Good to know. Never heard of that before.
Abe Miessler
+6  A: 

What you have there is called a junction table. It is also known as:

  • cross-reference table
  • bridge table
  • join table
  • map table
  • intersection table
  • linking table
  • link table

But I've never seen the term "lookup table" used for this purpose.

Mark Byers
My last manager constantly referred to them as lookup tables. That's the only reason I knew what the table was before I saw the layout given.
Justin Niessner
+6  A: 
OMG Ponies
Well said. There are more important things to dig your heels in about.
Toby Allen
Couldn't agree more with your "pick your battles" comment.
Abe Miessler
+1  A: 

A lookup table is normally a table that acts as a "master list" for something and you use it to look up a business key value (like "Make") in exachange for it's identifier (like the id column) for use in some other table's foreign key column.

Basically, you come in with something to "look up" and exchange it for something else.

The location_quadmap on the otherhand is a bridge table which, as others have already said, is used when you have a many-to-many relationship between two entities. If you call that a lookup table, then I'd say any table could be called a lookup table. Those tables only contain identifiers to other tables so you'd have to first look up the id on the one table, look up the id(s) that match in the bridge table, and then look up the matching row(s) in the 3rd table? Seems to be taking the term a little too far.

Patrick Marchand
+1  A: 

Mark Byers has the right definition for that table. Basically an intersect table. See any database textbook.

But in reality I've worked with many DBAs/Architects and most invent their own style for doing things and are not open to hearing anything else. Things like indentation rules, case for SQL statements, naming conventions for tables (even really bad ones), archival strategies, etc... You basically have no choice if they are in control of the database. You can mention it is an intersect table, point to the proper literature, but in the end if she wants to call it MyStupidlyLongAndPointlessPrefixForTablesBecauseICan_Lookup_Location_Quadmap and insists then there is nothing you can do.

So try to point it out to her, but if she doesn't go along with it, don't take it too seriously...

I just thought of something else. Lookup tables (our definition) are commonly called code tables as well. So she may call intersect tables lookup tables and lookup tables code tables. In which case you may have to learn to speak her language...

Cervo