What is a lookup table?

前端 未结 7 1116
有刺的猬
有刺的猬 2021-01-31 07:59

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

相关标签:
7条回答
  • 2021-01-31 08:29

    Lookup table is the table that contains only ID, name and the description of some subject/object/thing. ID is primary key and auto_increment. Nothing else.

    0 讨论(0)
  • 2021-01-31 08:33

    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.

    0 讨论(0)
  • 2021-01-31 08:33

    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...

    0 讨论(0)
  • 2021-01-31 08:34

    Pick your battles, but I'd ask for the person to clarify the naming convention seeing that they've suggested using the same convention for one-to-many and many-to-many relationships. Looks like any foreign key relationship means there's a "lookup" table involved.

    If that's the naming convention for other databases, then I wouldn't push my luck.

    0 讨论(0)
  • 2021-01-31 08:40

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

    0 讨论(0)
  • 2021-01-31 08:45

    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.

    0 讨论(0)
提交回复
热议问题