JournalSQLSetup and posting1 min

Import Parch & Posey on SQLite

It is handy and easy to use, and light weight which don't require to install a local server as well.

  • SQLite
  • DB Browser
  • Parch and Posey
  • CSV

Why should I use SQLite?

It is handy and easy to use, and light weight which don't require to install a local server as well.

Didn't download SQLite yet?

Try DB Browser for SQLite sqlitebrowser.org

1. Install Instructions of DB Browser for SQLite

install_sqlitebrowser

2. Create Parch & Posey Database

Copy this code and run it as show in image below:

CREATE TABLE `accounts` (
	`id`	INTEGER,
	`name`	TEXT,
	`website`	TEXT,
	`lat`	INTEGER,
	`long`	INTEGER,
	`primary_poc`	TEXT,
	`sales_rep_id`	INTEGER,
	PRIMARY KEY(`id`),
	FOREIGN KEY(`sales_rep_id`) REFERENCES `sales_reps`(`id`)
);

CREATE TABLE `orders` (
	`id`	INTEGER,
	`account_id`	INTEGER,
	`standard_qty`	INTEGER,
	`poster_qty`	INTEGER,
	`gloss_qty`	INTEGER,
	`total`	INTEGER,
	`occurred_at`	TEXT,
	`standard_amt_usd`	INTEGER,
	`gloss_amt_usd`	INTEGER,
	`poster_amt_usd`	INTEGER,
	`total_amt_usd`	INTEGER,
	FOREIGN KEY(`account_id`) REFERENCES `accounts`(`id`),
	PRIMARY KEY(`id`)
);

CREATE TABLE `region` (
	`id`	INTEGER,
	`name`	INTEGER,
	PRIMARY KEY(`id`)
);

CREATE TABLE `sales_reps` (
	`id`	INTEGER,
	`name`	TEXT,
	`region_id`	INTEGER,
	FOREIGN KEY(`region_id`) REFERENCES `region`(`id`),
	PRIMARY KEY(`id`)
);

CREATE TABLE `web_events` (
	`id`	INTEGER,
	`account_id`	INTEGER,
	`occurred_at`	TEXT,
	`channel`	TEXT,
	FOREIGN KEY(`account_id`) REFERENCES `accounts`(`id`),
	PRIMARY KEY(`id`)
);
create_parchposey

3. Download Parch & Posey .csv files

Click here to download tables of Parch & Posey database

Then extract the .zip archive.

4. Import Table from .csv file

4.1. Import region.csv

import_region

4.2. Import sales_reps.csv

import_sels_reps

4.3. Import accounts.csv

import_accounts

4.4. Import web_events.csv

import_web_events

4.5. Import orders.csv

import_orders

Happy querying 馃槈

and don't forget to click on "Write Changes"

query

Want to skip all these steps?

1. Click here to download Parch & Posey full database

2. Open Database

open_database