-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added readme files, and the database/datawarehouse documentation.
- Loading branch information
Showing
6 changed files
with
3,867 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is where the Main Business Quueries will be. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ETL process Documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
the data warehouse documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
-- This script was generated by the ERD tool in pgAdmin 4. | ||
-- Please log an issue at https://github.com/pgadmin-org/pgadmin4/issues/new/choose if you find any bugs, including reproduction steps. | ||
BEGIN; | ||
|
||
|
||
CREATE TABLE IF NOT EXISTS public.customers_dim | ||
( | ||
cust_sk integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
cust_id "char" NOT NULL, | ||
contact_name character varying(30) COLLATE pg_catalog."default" NOT NULL, | ||
company_name character varying(40) COLLATE pg_catalog."default" NOT NULL, | ||
cust_city character varying(15) COLLATE pg_catalog."default" NOT NULL, | ||
cust_country character varying(15) COLLATE pg_catalog."default", | ||
CONSTRAINT customers_dim_pkey PRIMARY KEY (cust_sk) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS public.date_dim | ||
( | ||
date_sk integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
date_id character varying(50) COLLATE pg_catalog."default" NOT NULL, | ||
date_field date NOT NULL, | ||
year numeric(4, 0) NOT NULL, | ||
month numeric(2, 0) NOT NULL, | ||
quarter numeric(1, 0) NOT NULL, | ||
day_of_month numeric(2, 0) NOT NULL, | ||
day_of_week character varying(30) COLLATE pg_catalog."default" NOT NULL, | ||
day_of_year numeric(3, 0) NOT NULL, | ||
CONSTRAINT date_dim_pkey PRIMARY KEY (date_sk) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS public.employees_dim | ||
( | ||
emp_sk integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
emp_id smallint NOT NULL, | ||
emp_title character varying(30) COLLATE pg_catalog."default" NOT NULL, | ||
hire_date date NOT NULL, | ||
emp_report_to smallint NOT NULL, | ||
CONSTRAINT employees_dim_pkey PRIMARY KEY (emp_sk) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS public.products_dim | ||
( | ||
product_sk integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
product_id smallint NOT NULL, | ||
product_name character varying(40) COLLATE pg_catalog."default" NOT NULL, | ||
supplier_id smallint NOT NULL, | ||
supplier_name character varying(40) COLLATE pg_catalog."default" NOT NULL, | ||
category_id smallint NOT NULL, | ||
category_name character varying(15) COLLATE pg_catalog."default" NOT NULL, | ||
quantity_per_unit character varying(20) COLLATE pg_catalog."default" NOT NULL, | ||
unit_price real NOT NULL, | ||
units_in_stock smallint NOT NULL, | ||
units_on_order smallint NOT NULL, | ||
record_level smallint NOT NULL, | ||
discontinued integer NOT NULL, | ||
CONSTRAINT products_dim_pkey PRIMARY KEY (product_sk) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS public.sales_fact | ||
( | ||
order_id smallint NOT NULL, | ||
sales_id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
product_sk integer NOT NULL, | ||
order_date_sk integer NOT NULL, | ||
required_date_sk integer NOT NULL, | ||
shipped_date_sk integer NOT NULL, | ||
emp_sk integer NOT NULL, | ||
cust_sk integer NOT NULL, | ||
supplier_company_name character varying(40) COLLATE pg_catalog."default" NOT NULL, | ||
category_name character varying(15) COLLATE pg_catalog."default" NOT NULL, | ||
unit_price real NOT NULL, | ||
quantity_per_order smallint NOT NULL, | ||
discount real NOT NULL, | ||
freight real NOT NULL, | ||
ship_city character varying(15) COLLATE pg_catalog."default" NOT NULL, | ||
ship_country character varying(15) COLLATE pg_catalog."default" NOT NULL, | ||
total_price real NOT NULL, | ||
shipper_company_name character varying(40) NOT NULL, | ||
CONSTRAINT sales_fact_pkey PRIMARY KEY (sales_id) | ||
); | ||
|
||
ALTER TABLE IF EXISTS public.employees_dim | ||
ADD CONSTRAINT fk_emp_recursive_mgr FOREIGN KEY (emp_report_to) | ||
REFERENCES public.employees_dim (emp_sk) MATCH SIMPLE | ||
ON UPDATE NO ACTION | ||
ON DELETE NO ACTION | ||
NOT VALID; | ||
|
||
|
||
ALTER TABLE IF EXISTS public.sales_fact | ||
ADD CONSTRAINT sales_fact_cust_sk_fkey FOREIGN KEY (cust_sk) | ||
REFERENCES public.customers_dim (cust_sk) MATCH SIMPLE | ||
ON UPDATE NO ACTION | ||
ON DELETE NO ACTION | ||
NOT VALID; | ||
|
||
|
||
ALTER TABLE IF EXISTS public.sales_fact | ||
ADD CONSTRAINT sales_fact_emp_sk_fkey FOREIGN KEY (emp_sk) | ||
REFERENCES public.employees_dim (emp_sk) MATCH SIMPLE | ||
ON UPDATE NO ACTION | ||
ON DELETE NO ACTION | ||
NOT VALID; | ||
|
||
|
||
ALTER TABLE IF EXISTS public.sales_fact | ||
ADD CONSTRAINT sales_fact_order_date_sk_fkey FOREIGN KEY (order_date_sk) | ||
REFERENCES public.date_dim (date_sk) MATCH SIMPLE | ||
ON UPDATE NO ACTION | ||
ON DELETE NO ACTION | ||
NOT VALID; | ||
|
||
|
||
ALTER TABLE IF EXISTS public.sales_fact | ||
ADD CONSTRAINT sales_fact_product_sk_fkey FOREIGN KEY (product_sk) | ||
REFERENCES public.products_dim (product_sk) MATCH SIMPLE | ||
ON UPDATE NO ACTION | ||
ON DELETE NO ACTION | ||
NOT VALID; | ||
|
||
|
||
ALTER TABLE IF EXISTS public.sales_fact | ||
ADD CONSTRAINT sales_fact_required_date_sk_fkey FOREIGN KEY (required_date_sk) | ||
REFERENCES public.date_dim (date_sk) MATCH SIMPLE | ||
ON UPDATE NO ACTION | ||
ON DELETE NO ACTION | ||
NOT VALID; | ||
|
||
|
||
ALTER TABLE IF EXISTS public.sales_fact | ||
ADD CONSTRAINT sales_fact_shipped_date_sk_fkey FOREIGN KEY (shipped_date_sk) | ||
REFERENCES public.date_dim (date_sk) MATCH SIMPLE | ||
ON UPDATE NO ACTION | ||
ON DELETE NO ACTION | ||
NOT VALID; | ||
|
||
END; |
Oops, something went wrong.