This is the start of my Mini Project for Northwind database
First I need to preload necessary pkgs to connect with MySQL WorkBench Server
# Set a CRAN mirror to avoid the error
options(repos = c(CRAN = "https://cran.fhcrc.org")) # URL of Vietnam CRAN mirror
install.packages("DBI")
install.packages("DiagrammeR")
install.packages("RSQLite")
library(DBI)
library(DiagrammeR)
library(RMySQL)
con <- dbConnect(
RMySQL::MySQL(),
dbname = "northwind",
host = "127.0.0.1", # or IP address if remote
port = 3306, # default MySQL port
user = "root",
password = "123"
)
con <- dbConnect(
RMySQL::MySQL(),
dbname = "northwind",
host = "127.0.0.1", # or IP address if remote
port = 3306, # default MySQL port
user = "root",
password = "123"
)
The project is about Northwind database, focusing on the information of customers, sellers and sales data
The database has several paths, which will be focused in the related schema below:
The northwind company is concerned about the customers and sales quality during the last period, which can be affected by the previous tornado occuring in the main regions the company covered.
You are asked to present a brief overview about how things are located in the database and try to confirm your theory by querying necessary outcomes.
Provide background information, concepts relevant to the project.
Discuss previous work or existing systems related to the project.
The goal is to query and find relevant information relating to your findings
Further insights may come in handy
CREATE TABLE employ (
Fname VARCHAR(50),
Minit VARCHAR(50),
Lname VARCHAR(50)
);
INSERT INTO employ(Fname, Minit, Lname)
VALUES("idk", "nice", "ok"),
("haha", "ikr", "notok"),
("huhu", "hihi", "haha")
SELECT *
FROM employ;
| Fname | Minit | Lname |
|---|---|---|
| idk | nice | ok |
| haha | ikr | notok |
| huhu | hihi | haha |
SELECT * FROM orders
| id | employee_id | customer_id | order_date | shipped_date | shipper_id | ship_name | ship_address | ship_city | ship_state_province | ship_zip_postal_code | ship_country_region | shipping_fee | taxes | payment_type | paid_date | notes | tax_rate | tax_status_id | status_id |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 30 | 9 | 27 | 2006-01-15 00:00:00 | 2006-01-22 00:00:00 | 2 | Karen Toh | 789 27th Street | Las Vegas | NV | 99999 | USA | 200 | 0 | Check | 2006-01-15 00:00:00 | NA | 0 | NA | 3 |
| 31 | 3 | 4 | 2006-01-20 00:00:00 | 2006-01-22 00:00:00 | 1 | Christina Lee | 123 4th Street | New York | NY | 99999 | USA | 5 | 0 | Credit Card | 2006-01-20 00:00:00 | NA | 0 | NA | 3 |
| 32 | 4 | 12 | 2006-01-22 00:00:00 | 2006-01-22 00:00:00 | 2 | John Edwards | 123 12th Street | Las Vegas | NV | 99999 | USA | 5 | 0 | Credit Card | 2006-01-22 00:00:00 | NA | 0 | NA | 3 |
| 33 | 6 | 8 | 2006-01-30 00:00:00 | 2006-01-31 00:00:00 | 3 | Elizabeth Andersen | 123 8th Street | Portland | OR | 99999 | USA | 50 | 0 | Credit Card | 2006-01-30 00:00:00 | NA | 0 | NA | 3 |
| 34 | 9 | 4 | 2006-02-06 00:00:00 | 2006-02-07 00:00:00 | 3 | Christina Lee | 123 4th Street | New York | NY | 99999 | USA | 4 | 0 | Check | 2006-02-06 00:00:00 | NA | 0 | NA | 3 |
| 35 | 3 | 29 | 2006-02-10 00:00:00 | 2006-02-12 00:00:00 | 2 | Soo Jung Lee | 789 29th Street | Denver | CO | 99999 | USA | 7 | 0 | Check | 2006-02-10 00:00:00 | NA | 0 | NA | 3 |
| 36 | 4 | 3 | 2006-02-23 00:00:00 | 2006-02-25 00:00:00 | 2 | Thomas Axen | 123 3rd Street | Los Angelas | CA | 99999 | USA | 7 | 0 | Cash | 2006-02-23 00:00:00 | NA | 0 | NA | 3 |
| 37 | 8 | 6 | 2006-03-06 00:00:00 | 2006-03-09 00:00:00 | 2 | Francisco Pérez-Olaeta | 123 6th Street | Milwaukee | WI | 99999 | USA | 12 | 0 | Credit Card | 2006-03-06 00:00:00 | NA | 0 | NA | 3 |
| 38 | 9 | 28 | 2006-03-10 00:00:00 | 2006-03-11 00:00:00 | 3 | Amritansh Raghav | 789 28th Street | Memphis | TN | 99999 | USA | 10 | 0 | Check | 2006-03-10 00:00:00 | NA | 0 | NA | 3 |
| 39 | 3 | 8 | 2006-03-22 00:00:00 | 2006-03-24 00:00:00 | 3 | Elizabeth Andersen | 123 8th Street | Portland | OR | 99999 | USA | 5 | 0 | Check | 2006-03-22 00:00:00 | NA | 0 | NA | 3 |
The database is wide and easy to read
A lot of things can be concluded from the database