├── README.md <- Project documentation.
├── data
│ ├── BASE_OBJETIVOS.csv <- Raw data to be normalized.
│ └── BASE_VENDAS.csv <- Raw data to be normalized.
│
├── docs <- Diagram in .png
│
├── sql_scripts
│ ├── normalization
│ │ ├── LOAD_OBJETIVO.sql <- Script to load normalized data into OBJETIVO table.
│ │ ├── LOAD_VENDA.sql <- Script to load normalized data into VENDA table.
│ │ ├── Normalizacao_CreateTempTABLES.sql <- Script to create temporary table.
│ │ ├── Normalizacao_InsertCSVtoTempTABLE.sql <- Script to load CSV data into temporary table.
│ │ ├── Normalizacao_TempObjetivos-CD.sql <- Script for normalization with related codes.
│ │ └── Normalizacao_TempVendas-CD.sql <- Script for normalization with related codes.
│ ├── queries
│ │ └── 3_Perguntas.sql <- Questions to be answered using the data.
│ └── setup
│ ├── 0_CreateDatabase.sql <- Script to create the database.
│ ├── 1_CreateTable.sql <- Script to create relational tables.
│ └── 2_Insert.sql <- Data insertion.
This repository was created with the dual purpose of sharing solutions developed for the challenges proposed in the selection process for the position of Senior Incentive Analyst at HSL Tecnologia, as well as documenting the technical data preparation process.
The first step was to install and configure SQL Server on my machine and connect to DBeaver for data handling.
The second step of this project involves the careful import of data from CSV files into temporary tables in SQL Server.
The normalization step follows, where imported data are restructured and optimized.
Scripts for this phase are available in the sql_script\normalization folder.
SCRIPTS
- 0_CreateDatabase.sql
- 1_CreateTable.sql
- 2_Insert.sql
- 3_Perguntas.sql
ARQUIVOS
- BASE_OBJETIVOS.csv
EAN
EQUIPE
VENDEDOR
JAN
FEV
MAR
ABR
MAI
JUN
JUL
AGO
SET
OUT
NOV
DEZ
- BASE_VENDAS.csv
EAN
EQUIPE
VENDEDOR
JAN
FEV
MAR
ABR
MAI
JUN
JUL
AGO
SET
OUT
NOV
DEZ
DATABASE
OBJETIVO
CD_VENDA
PRIMARY KEYCD_PRODUTO
FOREIGN KEYCD_EQUIPE
FOREIGN KEYCD_USUARIO
FOREIGN KEYDT_PERIODO
NR_QUANTIDADE
VENDA
CD_VENDA
PRIMARY KEYCD_PRODUTO
FOREIGN KEYCD_EQUIPE
FOREIGN KEYCD_USUARIO
FOREIGN KEYDT_PERIODO
NR_QUANTIDADE
PRODUTO
CD_PRODUTO
PRIMARY KEYNM_PRODUTO
EAN
EQUIPE
CD_EQUIPE
PRIMARY KEYNM_EQUIPE
CD_EMPRESA
FOREIGN KEY
EMPRESA
CD_EMPRESA
PRIMARY KEYNN_EMPRESA
USARIO
CD_USUARIO
PRIMARY KEYNM_USUARIO
EQUIPE_PRODUTO
CD_EQUIPE_PRODUTO
PRIMARY KEYCD_EQUIPE
FOREIGN KEYCD_PRODUTO
FOREIGN KEYNR_PESO
EMPRESA_PRODUTO
CD_EMPRESA_PRODUTO
PRIMARY KEYCD_EMPRESA
FOREIGN KEYCD_PRODUTO
FOREIGN KEY
EQUIPE_USUARIO
CD_EQUIPE_USUARIO
PRIMARY KEYCD_EQUIPE
FOREIGN KEYCD_USUARIO
FOREIGN KEY
USUARIO_EMPRESA
CD_EMPRESA_USUARIO
PRIMARY KEYCD_EMPRESA
FOREIGN KEYCD_USUARIO
FOREIGN KEY
-
Team and Product Analysis:
- Objective: Return the information of "Company name", "Team name", "User name", and "Quantity of Products" associated with the user in their respective team.
- Filter: Products with a weight greater than 10%.
- Sorting: By "Team" and "User".
-
Best-Selling Products by Team:
- Objective: Return "Team name", "Product name", and the "Quantity of Products sold".
- Specification: Only for the best-selling products in each team.
-
Sales and Ranking in the First Semester:
- Objective: Return "Team name", "Product name", "User name", "Quantity of Products sold", and the "Ranking".
- Period: Only in the 1st semester (January to June).
-
Objectives by Quarter:
- Objective: Return "Team name", "User name", "Product name", "Quarter name" (e.g., "1st Quarter") and the "average objectives per quarter".
- Sorting: By "Team name", "User name", "Product name", and "average objectives per quarter" (descending).
-
Monthly Sales Coverage:
- Objective: Return "Month", "Team name", "User name", "Product name", "Objective", "Sale", and the "Sales achievement coverage (sale/objective)".
- Specification: Only the lowest coverage achievements for each month.
-
Bactrim Sales Performance in May:
- Objective: Return "User name", "Units of Products sold", "Objective", and the percentage of objective achievement in May, for the product Bactrim.
- Sorting: By performance in descending order.
-
Yasmin's Sales and Representativeness:
- Objective: Return "Product name", the quantity sold of each, and its representativeness in the total sales of the user "Yasmin".
- Sorting: By representativeness descending.
-
Quarterly Sales Growth:
- Objective: Return "User name", "Product name", the quantity sold in the second quarter, the quantity sold in the third quarter, and the percentage growth from the second to the third quarter.
- Specification: Only for the highest and lowest growths.
-
Monthly Performance/Coverage of Sales:
- Objective: Return a list of performance/coverage (Sale / Objective) of "User name", "Product name" for all months and "Year".
- Details: Coverage of each month in separate columns with two decimal places.
- Filter: Only for the Sales team.
-
Best Paracetamol Seller in the Last Quarter:
- Objective: Identify the "User name" who was the best seller of Paracetamol in the last quarter of the year.
- Company: Considering all teams of the company ALPHALAB.
-
Worst Nimesulida Seller in the First Quarter:
- Objective: Identify the "User name" who was the worst seller of Nimesulida in the first quarter of the year.
- Company: Considering all teams of the company Labmais.
-
Best Meloxicam Seller of the Year:
- Objective: Identify the "User name" who was the best (coverage) seller of Meloxicam this year.
- Company: Considering all teams of the company ALPHALAB.