← All schemas
Schema Library

Northwind Database Diagram

Northwind Traders is Microsoft's classic sample database - a food importer/exporter used in tutorials for decades - ported here to PostgreSQL. Customers place orders handled by employees; orders contain order_details lines referencing products; products come from suppliers and belong to categories; employees report to other employees and cover territories through a join table. Fourteen tables are mapped above. The detail that makes Northwind a great teaching schema: order_details uses a composite primary key of (order_id, product_id), and employees has a self-referencing reports_to foreign key - the two patterns every ER diagram course teaches.

Last updated: 2026-09-27

Source: Northwind Traders sample database, PostgreSQL port (pthom/northwind_psql) - originally a Microsoft sample database; the port repository carries no license file, so check its terms before reuse

Tables
14
Core flow
Customer -> Order -> Order Details
Origin
Microsoft sample, PG port
Mini Map
Open in DBdiagramr to edit →

Tables in the Northwind schema

ColumnTypeNullableKey
categories
category_idsmallintNoPK
category_namecharacter varying(15)No-
descriptiontextYes-
picturebyteaYes-
customer_customer_demo
customer_idcharacter varying(5)NoPK
customer_type_idcharacter varying(5)NoPK
customer_demographics
customer_type_idcharacter varying(5)NoPK
customer_desctextYes-
customers
customer_idcharacter varying(5)NoPK
company_namecharacter varying(40)No-
contact_namecharacter varying(30)Yes-
contact_titlecharacter varying(30)Yes-
addresscharacter varying(60)Yes-
citycharacter varying(15)Yes-
regioncharacter varying(15)Yes-
postal_codecharacter varying(10)Yes-
countrycharacter varying(15)Yes-
phonecharacter varying(24)Yes-
faxcharacter varying(24)Yes-
employees
employee_idsmallintNoPK
last_namecharacter varying(20)No-
first_namecharacter varying(10)No-
titlecharacter varying(30)Yes-
title_of_courtesycharacter varying(25)Yes-
birth_datedateYes-
hire_datedateYes-
addresscharacter varying(60)Yes-
citycharacter varying(15)Yes-
regioncharacter varying(15)Yes-
postal_codecharacter varying(10)Yes-
countrycharacter varying(15)Yes-
home_phonecharacter varying(24)Yes-
extensioncharacter varying(4)Yes-
photobyteaYes-
notestextYes-
reports_tosmallintYes-
photo_pathcharacter varying(255)Yes-
employee_territories
employee_idsmallintNoPK
territory_idcharacter varying(20)NoPK
order_details
order_idsmallintNoPK
product_idsmallintNoPK
unit_pricerealNo-
quantitysmallintNo-
discountrealNo-
orders
order_idsmallintNoPK
customer_idcharacter varying(5)Yes-
employee_idsmallintYes-
order_datedateYes-
required_datedateYes-
shipped_datedateYes-
ship_viasmallintYes-
freightrealYes-
ship_namecharacter varying(40)Yes-
ship_addresscharacter varying(60)Yes-
ship_citycharacter varying(15)Yes-
ship_regioncharacter varying(15)Yes-
ship_postal_codecharacter varying(10)Yes-
ship_countrycharacter varying(15)Yes-
products
product_idsmallintNoPK
product_namecharacter varying(40)No-
supplier_idsmallintYes-
category_idsmallintYes-
quantity_per_unitcharacter varying(20)Yes-
unit_pricerealYes-
units_in_stocksmallintYes-
units_on_ordersmallintYes-
reorder_levelsmallintYes-
discontinuedintegerNo-
region
region_idsmallintNoPK
region_descriptioncharacter varying(60)No-
shippers
shipper_idsmallintNoPK
company_namecharacter varying(40)No-
phonecharacter varying(24)Yes-
suppliers
supplier_idsmallintNoPK
company_namecharacter varying(40)No-
contact_namecharacter varying(30)Yes-
contact_titlecharacter varying(30)Yes-
addresscharacter varying(60)Yes-
citycharacter varying(15)Yes-
regioncharacter varying(15)Yes-
postal_codecharacter varying(10)Yes-
countrycharacter varying(15)Yes-
phonecharacter varying(24)Yes-
faxcharacter varying(24)Yes-
homepagetextYes-
territories
territory_idcharacter varying(20)NoPK
territory_descriptioncharacter varying(60)No-
region_idsmallintNo-
us_states
state_idsmallintNoPK
state_namecharacter varying(100)Yes-
state_abbrcharacter varying(2)Yes-
state_regioncharacter varying(50)Yes-

Frequently asked questions

What tables are in the Northwind database?

Northwind has 14 tables: categories, customers, customer_demographics, customer_customer_demo, employees, employee_territories, territories, region, orders, order_details, products, suppliers, shippers, and us_states.

How are orders and products linked in Northwind?

Through the order_details join table, which has a composite primary key of (order_id, product_id) plus quantity, unit price, and discount. One order has many lines; each line references exactly one product.

How does Northwind model employee reporting lines?

With a self-referencing foreign key: employees.reports_to points at employees.employee_id, so each employee row links to their manager's row. Territories add a second dimension via the employee_territories join table.

Explore more schemas

Visualize your own database

Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.

Try it free →