5

I need some clarification. What is a lookup table and what is a reference table in SQL?

I was under the impression that a lookup table is a table that has static data that hardly ever changes (e.g. a table that has all 50 states and their capitals) and a reference table is one that contains primary keys and links two other tables. In the example below, Table B would be a reference table. Can someone tell me what Table B is called?

Table A
CustomerID
CustomerName
CustomerAddress

Table B
CustomerID
OrderID

Table C
OrderID
OrderDate
ChrisWue
  • 18,612
  • 4
  • 58
  • 83
Halcyon
  • 14,631
  • 17
  • 68
  • 99

3 Answers3

10

Table B is a Link Table or Junction Table.

Reference and Lookup tables can mean different things for different sources, and I am not aware of a strict definition to differentiate the two.

For me personally I normally use a reference to mean an long value stored out of the main table (like a StoreID), and lookup to mean a list of allowable values (enforced by a FK constraint) for a certain field.

JNK
  • 63,321
  • 15
  • 122
  • 138
3

There is no hard-and-fast definition for those terms. It really comes down to whether or not the other person knows what you are talking about.

Among the people I work with table B would be called a "Mapping Table".

Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447
2
  • Fork table
  • many-to-many relation table
  • link table
  • map table
Oleg Dok
  • 21,109
  • 4
  • 45
  • 54