{"id":13402701,"url":"https://github.com/harryho/db-samples","last_synced_at":"2025-08-20T10:32:03.940Z","repository":{"id":46986623,"uuid":"219280041","full_name":"harryho/db-samples","owner":"harryho","description":"Northwind sample database for MySql, PostgresQL etc.","archived":false,"fork":false,"pushed_at":"2020-12-20T10:32:55.000Z","size":788,"stargazers_count":132,"open_issues_count":0,"forks_count":121,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-07-31T19:38:04.079Z","etag":null,"topics":["json","mongodb","mysql","northwind","postgresql","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harryho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-03T09:51:34.000Z","updated_at":"2024-07-18T17:19:51.000Z","dependencies_parsed_at":"2022-08-12T13:11:23.687Z","dependency_job_id":null,"html_url":"https://github.com/harryho/db-samples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fdb-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fdb-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fdb-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryho%2Fdb-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harryho","download_url":"https://codeload.github.com/harryho/db-samples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230415318,"owners_count":18222158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","mongodb","mysql","northwind","postgresql","sqlite","sqlite3"],"created_at":"2024-07-30T19:01:19.714Z","updated_at":"2024-12-19T10:09:22.880Z","avatar_url":"https://github.com/harryho.png","language":"JavaScript","readme":"Northwind sample database for MySql, PostgresQL, and more\n====\n\nThis project is inspired by [Microsoft Sample Databases](https://github.com/Microsoft/sql-server-samples), but it only targets other databases, such as MySql, PostgresQL, etc. \n\nThis folder contains scripts to create and load the Northwind sample databases.\n\n\nIf you are looking for the script of MS Sql Server, please check out the repository from their github.\n\nThis project is created to create a sample CRM-like demo database in a few seconds with tiny test data.\n\n### Caveat\n\nThe sample databases in the project are customized. Some tables' and columns' names have been changed on purpose. \n\n### Difference from the sample of MS Sql Server\n\n* Additional columns on some tables, e.g. email, mobile. \n* All photo sample data has been removed, and additional photoPath is added for flexible implementation.\n* NorthwindCore is designed for Entity Framework\n\n### ER Diagram\n\n* The ER diagram only contains PK and FKs\n* The ER file is created by MySQl Workbrench. You can open the file with the same tool.\n\n#### Northwind \n\n\n![northwind_er_diagram](mysql/northwind_er_diagram.png)\n\n####  NorthwindCore\n\n\n* Every table in NorthwindCore contains column EntityId.  \n\n![northwindcore_er_diagram](mysql/northwindcore_er_diagram.png)\n\n\n\n### Restore the database from SQL script\n\n#### MySql\n\n```bash\nmysql -u user_id -p northwind \u003c northwind.sql\n```\n\n\n#### PostgresQL\n\n\n```\nsudo su - postgres\npsql -d postgres -U postgres -f northwind.sql\n```\n\n#### MongoDB\n\n* Firstly, install MongoDB community server, shell and tools\n* Launch the mongoDB server\n\n```\n# Launch mongodb in Linux \nsystemctl start mongod\n\n```\n\n* Create the db northwind and import the data\n\n```\nsh mongo_import.sh\n\necho \"db.getCollectionNames()\" \u003e getColNames.js\n\nmongo mongodb://localhost/northwind \u003c getColNames.js\n\n# You may see some output as follow:\n# .......\n# ......\n# MongoDB server version: x.x.x\n# [\n# \t\"category\",\n# \t\"customer\",\n# \t\"employee\",\n# \t\"employeeTerritory\",\n# \t\"orderDetail\",\n# \t\"product\",\n# \t\"region\",\n# \t\"salesOrder\",\n# \t\"shipper\",\n# \t\"supplier\",\n# \t\"territory\"\n# ]\n\n```\n\n#### Sqlite\n\n* Install [sqlite3](https://www.sqlite.org/)\n* Create northwind db\n\n```\ncd db-samples/sqlite3\nsqlite3 northwind.db \u003c northwind_core.sql\nsqlite3 northwind.db\n\u003e.tables\n```\n\n#### Json Flat file\n\n* Json flat file is great for intergation test or demostraction\n* Folder json contains a few json flat files\n* json_data.min.json is the original data set\n* json_tiny.json is version with only a small data set\n\n\n### TODO\n\n* ~~Add script for MongoDB~~\n* ~~Add script for Sqlite~~\n\n\n\n\n","funding_links":[],"categories":["JavaScript","TSQL"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryho%2Fdb-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharryho%2Fdb-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryho%2Fdb-samples/lists"}