什么是查找表?[英] What is a lookup table?

本文是小编为大家收集整理的关于什么是查找表?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我刚刚给了一个我创建的数据库数据库人员的数据库图,她在上面放了很多笔记,这表明我重命名了某些表格,因此很明显它们是查找表(将" lu"添加到表名的开始).

我的问题是,这些问题不符合我认为查找表的定义.我一直认为查找表基本上是一组未定义任何关系的选项.示例:

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

我工作中的数据库人员建议我重命名几个表格,这些表只是将一个表映射到另一个表作为查找表.示例(Location_quadmap下面):

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

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

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

可以肯定地假设她误读了图表,还是我不知道的另一个定义?

推荐答案

您拥有的东西称为交界表.它也称为:

  • 交叉引用表
  • 桥桌
  • 加入表
  • 地图表
  • 交叉表
  • 链接表
  • 链接表

,但我从未见过为此目的使用的"查找表"一词.

其他推荐答案

选择您的战斗 ,但我会要求该人澄清命名惯例,发现他们建议使用相同的约定为一经常的关系.看起来任何外国密钥关系意味着涉及"查找"表.

如果这是其他数据库的命名约定,那么我不会推我的运气.

其他推荐答案

查找表通常是一个表现为某物的"主列表"的表)用于其他表格的外键列.

基本上,您会带来一些"查找"并将其换成其他东西的东西.

另一方面,位于位置_quadmap是一个桥接表,正如其他人已经说过的那样,当您在两个实体之间建立了多一关系时,就会使用它.如果您称该表为查找表,那么我会说任何表都可以称为查找表.这些表仅包含其他表格的标识符,因此您必须首先查找一个表上的ID,查找在桥表中匹配的ID(s),然后查找匹配行(s)第三桌?似乎要把这个词有点过分了.

本文地址:https://www.itbaoku.cn/post/597698.html

问题描述

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 lookup table to be. I have always considered a lookup 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 mapping 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?

推荐答案

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.

其他推荐答案

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.

其他推荐答案

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.