2021-01-21

範例資料庫(Sample Database)

使用現成的範例資料庫,可以有效幫助SQL語法的學習,微軟在GitHub上釋出多個範例資料庫(Sample Database):
  • Official Microsoft GitHub Repository containing code samples for SQL Server
    https://github.com/microsoft/sql-server-samples
    https://github.com/microsoft/sql-server-samples/tree/master/samples/databases  
    • wide-world-importers
    • contoso-data-warehouse
    • AdventureWorks
    • Northwind 
    • Pubs
  • 範例資料庫的資料庫關聯圖(database diagram)(實體關聯圖 ER Diagram)
    • AdventureWorks OLTP Database Diagram
    • https://improveandrepeat.com/wp-content/uploads/2018/12/AdvWorksOLTPSchemaVisio.png
    • An ER Diagram for the Northwind Sample Database
      https://documentation.red-gate.com/dms6/files/49646072/49646073/3/1559655630714/ERDiagramNorthwind.png
    • An ER Diagram for the PUBS Sample Database
      https://documentation.red-gate.com/dms6/files/49646075/49646076/2/1559655574834/ERDiagramPUBS.png

除了上述微軟提供的範例資料庫,還有一個常用來替代Northwind的資料庫:Chinook
Chinook : Sample database for SQL Server, Oracle, MySQL, PostgreSQL, SQLite, DB2
下載取得Chinook的資料:
https://github.com/lerocha/chinook-database/tree/master/ChinookDatabase/DataSources


Chinook 範例資料庫的Database diagram:
http://schemaspy.org/sample/relationships.html 
http://schemaspy.org/sample/diagrams/summary/relationships.real.compact.png 
http://schemaspy.org/sample/diagrams/summary/relationships.real.large.png