Example schema · SQL Server · 13 tables · 13 relationships

Northwind database ER diagram

Microsoft's classic trading-company sample — customers, orders, products and shippers — rendered from the T-SQL install script, GO batches and all.

SQL input — CREATE TABLE · DDL · dumpsqlserver
sqlserverSample: · · · · ·
Diagram13 tables · 13 foreign keys
Northwind ER diagram — 13 tables, 13 relationshipsEmployeesTABLEEmployeeIDPKNNintegerLastNameNNnvarchar(20)FirstNameNNnvarchar(10)Titlenvarchar(30)TitleOfCourt…nvarchar…BirthDatedatetimeHireDatedatetimeAddressnvarchar(60)+ 10 more columnsCategoriesTABLECategoryIDPKNNintegerCategoryN…NNnvarchar…Descriptionvarchar(max)PictureimageCustomersTABLECustome…PKNNnchar…CompanyN…NNnvarchar…ContactNamenvarchar(30)ContactTitlenvarchar(30)Addressnvarchar(60)Citynvarchar(15)Regionnvarchar(15)PostalCodenvarchar(10)+ 3 more columnsShippersTABLEShipperIDPKNNintegerCompanyN…NNnvarchar…Phonenvarchar(24)SuppliersTABLESupplier…PKNNinteg…CompanyN…NNnvarchar…ContactNamenvarchar(30)ContactTitlenvarchar(30)Addressnvarchar(60)Citynvarchar(15)Regionnvarchar(15)PostalCodenvarchar(10)+ 4 more columnsOrdersTABLEOrderIDPKNNintegerCustomerIDFKnchar(5)EmployeeIDFKintegerOrderDatedatetimeRequiredDatedatetimeShippedDatedatetimeShipViaFKintegerFreightmoney+ 6 more columnsProductsTABLEProductIDPKNNintegerProductN…NNnvarchar(…SupplierIDFKintegerCategoryIDFKintegerQuantityPerU…nvarchar…UnitPricemoneyUnitsInStocksmallintUnitsOnOrdersmallint+ 2 more columnsOrder DetailsTABLEOrderIDPKFKNNintegerProduc…PKFKNNint…UnitPriceNNmoneyQuantityNNsmallintDiscountNNfloatdbo.CustomerCustomerDemoTABLECustomerIDFKNNnchar(5)CustomerTypeIDFKNNnchar(10)dbo.CustomerDemographicsTABLECustomerTypeIDNNnchar(10)CustomerDescvarchar(max)dbo.RegionTABLERegionIDNNintegerRegionDescript…NNnchar…dbo.TerritoriesTABLETerritoryIDNNnvarchar(20)TerritoryDescript…NNnchar…RegionIDFKNNintegerdbo.EmployeeTerritoriesTABLEEmployeeIDFKNNintegerTerritoryIDFKNNnvarchar(20)
About the schema

What you're looking at

Northwind Trades ships specialty foods, and its schema has taught generations of developers relational basics: customers place orders, orders contain products through the Order Details junction, products come from suppliers in categories. This page renders the 13-table schema exactly as the official install script declares it — T-SQL with GO batch separators, quoted identifiers, and inline foreign keys.

The install script's INSERT data rows are skipped — what renders here is the schema, which is the part the diagram is about.

Nothing above is hand-drawn — the diagram is generated from the official schema file, the same SQL you would paste into the SQL to ER diagram converter.

Working in SQL Server? The SQL Server to ER diagram converter takes any SQL Server DDL — schema dump files, hand-written DDL, or a single CREATE TABLE.

Credits

Where the schema comes from

  • Source: microsoft/sql-server-samples
  • License: MIT (repository license)
  • The schema belongs to its original authors; the diagram above was generated by erd.yizuolab.com.
FAQ

Questions, answered

What is the Northwind database?

Northwind is Microsoft's classic sample database for a specialty-foods trading company. It has shipped with Access and SQL Server tutorials since the 1990s and remains the standard first schema people learn joins on.

Does the diagram include the sample data?

No — the render is schema-only: 13 tables and their 13 relationships. The official install script carries thousands of INSERT rows; those are skipped, which is also why this page stays fast.

What dialect is this written in?

T-SQL, exactly as the official instnwnd.sql script declares it — GO batch separators, quoted identifiers, and inline PRIMARY KEY / FOREIGN KEY constraints, including the bracketed [dbo].[Region]-style tables Northwind adds later in the script.

What license is the Northwind schema under?

The Microsoft sql-server-samples repository ships it under an MIT license. The schema belongs to its original authors; the diagram above was generated from their file.

More examples

Other real schemas