Git Product home page Git Product logo

db-samples's Introduction

Northwind sample database for MySql, PostgresQL, and more

This project is inspired by Microsoft Sample Databases, but it only targets other databases, such as MySql, PostgresQL, etc.

This folder contains scripts to create and load the Northwind sample databases.

If you are looking for the script of MS Sql Server, please check out the repository from their github.

This project is created to create a sample CRM-like demo database in a few seconds with tiny test data.

Caveat

The sample databases in the project are customized. Some tables' and columns' names have been changed on purpose.

Difference from the sample of MS Sql Server

  • Additional columns on some tables, e.g. email, mobile.
  • All photo sample data has been removed, and additional photoPath is added for flexible implementation.
  • NorthwindCore is designed for Entity Framework

ER Diagram

  • The ER diagram only contains PK and FKs
  • The ER file is created by MySQl Workbrench. You can open the file with the same tool.

Northwind

northwind_er_diagram

NorthwindCore

  • Every table in NorthwindCore contains column EntityId.

northwindcore_er_diagram

Restore the database from SQL script

MySql

mysql -u user_id -p northwind < northwind.sql

PostgresQL

sudo su - postgres
psql -d postgres -U postgres -f northwind.sql

MongoDB

  • Firstly, install MongoDB community server, shell and tools
  • Launch the mongoDB server
# Launch mongodb in Linux 
systemctl start mongod

  • Create the db northwind and import the data
sh mongo_import.sh

echo "db.getCollectionNames()" > getColNames.js

mongo mongodb://localhost/northwind < getColNames.js

# You may see some output as follow:
# .......
# ......
# MongoDB server version: x.x.x
# [
# 	"category",
# 	"customer",
# 	"employee",
# 	"employeeTerritory",
# 	"orderDetail",
# 	"product",
# 	"region",
# 	"salesOrder",
# 	"shipper",
# 	"supplier",
# 	"territory"
# ]

Sqlite

  • Install sqlite3
  • Create northwind db
cd db-samples/sqlite3
sqlite3 northwind.db < northwind_core.sql
sqlite3 northwind.db
>.tables

Json Flat file

  • Json flat file is great for intergation test or demostraction
  • Folder json contains a few json flat files
  • json_data.min.json is the original data set
  • json_tiny.json is version with only a small data set

TODO

  • Add script for MongoDB
  • Add script for Sqlite

db-samples's People

Contributors

harryho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.