J

@joaodev__

02_transform

SQL
6 months ago
/* TRANSFORMAR (limpando e padronizando) */ DROP TABLE IF EXISTS faturamento_tratado; CREATE TABLE faturamento_tratado AS SELECT id, motorista, datetime(inicio) AS inicio, datetime(fim) AS fim, CAST(

01_raw_tables

SQL
6 months ago
/* Criar tabelas BRUTAS (Raw Layer) */ DROP TABLE IF EXISTS faturamento_raw; DROP TABLE IF EXISTS pesagem_raw; CREATE TABLE faturamento_raw ( id INTEGER, motorista TEXT, inicio TEXT, fim TEXT, valor TEXT

Mini ETL Operacional

SQL
6 months ago
/* Criar tabelas BRUTAS (Raw Layer) */ DROP TABLE IF EXISTS faturamento_raw; DROP TABLE IF EXISTS pesagem_raw; CREATE TABLE faturamento_raw ( id INTEGER, motorista TEXT, inicio TEXT, fim TEXT, valor TEXT

03_kpi_queries

SQL
6 months ago
SELECT printf( '%02d:%02d:%02d', AVG((substr(tempo_faturamento,1,2) * 3600) + (substr(tempo_faturamento,4,2) * 60) + (substr(tempo_faturamento,7,2))) / 3600, (AVG((substr(tempo_faturamento,1,2) * 3600) + (substr(tempo_faturamento,4,2) * 60) + (substr(tempo_faturamento,7,2))) % 3600) / 60, AVG((substr(tempo_faturamento,1,2) * 3600) +

02_insert_data

SQL
6 months ago
INSERT INTO faturamento (data, ticket, transportadora, produto, peso, tempo_faturamento) VALUES ('2025-01-01', 'T001', 'Transvale', 'Etanol', 28000, '00:06:30'), ('2025-01-01', 'T002', 'Rodomax', 'Diesel', 32000, '00:05:20'), ('2025-01-02', 'T003', 'Transvale', 'Gasolina', 29500, '00:07:10'), ('2025-01-03', 'T004', 'LogBR', 'Etanol', 31000, '00:06:50'); INSERT INTO pesagem (data, placa, peso_entrada, peso_saida, tempo_no_patio) VALUES ('2025-01-01', 'ABC1234', 12000, 40500, '01:20:00'),

01_create_tables

SQL
6 months ago
CREATE TABLE faturamento ( id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT, ticket TEXT, transportadora TEXT, produto TEXT, peso REAL, tempo_faturamento TEXT );

Mini Data Warehouse Operacional

SQL
6 months ago
CREATE TABLE faturamento ( id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT, ticket TEXT, transportadora TEXT, produto TEXT, peso REAL, tempo_faturamento TEXT );

Cálculos Básicos

NodeJS
9 months ago
// math.js function somar(a, b) { return a + b; } function multiplicar(a, b) { return a * b; } // Exportando as funções

Variáveis Iniciais

NodeJS
9 months ago
// app.js console.log("Hello World Node.js!"); // Variáveis e tipos básicos const nome = "João"; const idade = 23; const estudante = "Sim!"; console.log(`Olá ${nome}, você tem ${idade} anos`); console.log(`É estudante? ${estudante}`);

Tabela com Pessoas

SQL
1 year ago
-- Criação da tabela "Pessoas" CREATE TABLE Pessoas ( Matricula INT PRIMARY KEY, Nome VARCHAR(50) NOT NULL, Genero CHAR(1) CHECK (Genero IN ('M', 'F')), Cargo VARCHAR(50) NOT NULL, Cidade VARCHAR(50) NOT NULL ); -- Inserção de dados na tabela "Pessoas"

Tabela com Pessoas

SQL
1 year ago
-- Criação da tabela "Pessoas" CREATE TABLE Pessoas ( Matricula INT PRIMARY KEY, Nome VARCHAR(50) NOT NULL, Genero CHAR(1) CHECK (Genero IN ('M', 'F')), Cidade VARCHAR(50) NOT NULL ); -- Inserção de dados na tabela "Pessoas" INSERT INTO Pessoas (Matricula, Nome, Genero, Cidade) VALUES

Tabela com Pessoas

SQL
1 year ago
-- Criação da tabela "Pessoas" CREATE TABLE Pessoas ( Matricula INT PRIMARY KEY, Nome VARCHAR(50) NOT NULL, Genero CHAR(1) CHECK (Genero IN ('M', 'F')), Cidade VARCHAR(50) NOT NULL ); -- Inserção de dados na tabela "Pessoas" INSERT INTO Pessoas (Matricula, Nome, Genero, Cidade) VALUES