Junction Table

In database management systems following the relational model, a junction table is a database table that contains common fields from two or more other database tables within the same database. It is on the many side of a one-to-many relationship with each of the other tables. Junction tables are known under many names, among them cross-reference table, bridge table, join table, map table, intersection table, linking table, many-to-many resolver, link table, pairing table, pivot table, transition table, or association table.

Junction tables are employed when dealing with many-to-many relationships in a database. A practical use of a junction table would be to assign permissions to users. There can be multiple users, and each user can be assigned 0 or more permissions.


CREATE TABLE Users ( UserLogin VARCHAR(50) PRIMARY KEY, UserPassword VARCHAR(50) NOT NULL, UserName VARCHAR(50) NOT NULL ) CREATE TABLE Permissions ( PermissionKey VARCHAR(50) PRIMARY KEY, PermissionDescription VARCHAR(500) NOT NULL ) -- This is the junction table. CREATE TABLE UserPermissions ( UserLogin VARCHAR(50) REFERENCES Users (UserLogin), PermissionKey VARCHAR(50) REFERENCES Permissions (PermissionKey), PRIMARY KEY (UserLogin, PermissionKey) )

Read more about Junction Table:  Using Junction Tables

Famous quotes containing the words junction and/or table:

    In order to get to East Russet you take the Vermont Central as far as Twitchell’s Falls and change there for Torpid River Junction, where a spur line takes you right into Gormley. At Gormley you are met by a buckboard which takes you back to Torpid River Junction again.
    Robert Benchley (1889–1945)

    ... So damn your food and damn your wines,
    Your twisted loaves and twisting vines,
    Your table d’hôte, your à la carte,
    . . . .
    From now on you can keep the lot.
    Take every single thing you’ve got,
    Your land, your wealth, your men, your dames,
    Your dream of independent power,
    And dear old Konrad Adenauer,
    And stick them up your Eiffel Tower.
    Anthony Jay (b. 1930)