SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
You can do it in SQL
Drew Banin (he/him)
Chief Product Officer
2
mo’ data mo’ problems
@drewbanin on Twitter
● Open core data modeling software
● dbt provides a SQL-first workflow for:
- Data modeling
- Data testing
- Data documentation
- And more!
You can learn more at getdbt.com
We’re the makers of dbt
Confessions & disclaimers
● I have never written a line of production Scala code in my life
● I have written a whole lot of SQL in my life
● People who tolerate Python packaging don’t get to complain about the JVM
I ❤ SQL
, Expressive
, Accessible
, Universal
, Declarative
, Thought provoking….?
I ❤ SQL
, Expressive - SQL reads more or less like a real sentence
, Accessible
, Universal
, Declarative
, Thought provoking….?
I ❤ SQL
, Expressive
, Accessible - Lots of people can learn in pretty quickly
, Universal
, Declarative
, Thought provoking….?
I ❤ SQL
, Expressive
, Accessible
, Universal - Most databases speak SQL with pretty consistent support
, Declarative
, Thought provoking….?
I ❤ SQL
, Expressive
, Accessible
, Universal
, Declarative - No moving parts, limited opportunities for the bad kind of magic
, Thought provoking….?
I ❤ SQL
, Expressive
, Accessible
, Universal
, Declarative
, Thought provoking….?
Some things you can do in SQL
Technique: Pivoting Columns
What: convert rows of data into columns of data
Why: to derive new metrics from existing rows in a table
Pivoting columns
What: convert rows of data into columns of data
Why: to derive new metrics from existing rows in a table
Pivoting columns
user_id event_name happened_at
1 signup 2021-01-01
1 purchase 2021-01-02
2 signup 2021-01-03
3 signup 2021-01-04
3 purchase 2021-01-05
1 purchase 2021-01-05
What: convert rows of data into columns of data
Why: to derive new metrics from existing rows in a table
Pivoting columns
user_id event_name happened_at
1 signup 2021-01-01
1 purchase 2021-01-02
2 signup 2021-01-03
3 signup 2021-01-04
3 purchase 2021-01-05
1 purchase 2021-01-05
What: convert rows of data into columns of data
Why: to derive new metrics from existing rows in a table
Pivoting columns
user_id event_name happened_at
1 signup 2021-01-01
1 purchase 2021-01-02
2 signup 2021-01-03
3 signup 2021-01-04
3 purchase 2021-01-05
1 purchase 2021-01-05
user_id signup_date purchases
1 2021-01-01 2
2 2021-01-02 0
3 2021-01-04 1
Technique: Appending datasets
Unions
What: append tables together
Why: combine tables into a taller table
Unions
What: append tables together
Why: combine tables into a taller table
user_id event_name happened_at
1 signup 2021-01-01
1 purchase 2021-01-02
2 signup 2021-01-03
user_id event_name happened_at
1 app_install 2021-01-01
1 screen_view 2021-01-02
2 app_install 2021-01-03
web_events mobile_events
Unions
What: append tables together
Why: combine tables into a taller table
source user_id event_name happened_at
mobile 1 app_install 2021-01-01
mobile 1 screen_view 2021-01-02
mobile 2 app_install 2021-01-03
web 1 signup 2021-01-01
web 1 purchase 2021-01-02
web 2 signup 2021-01-03
all_events
Technique: Window functions
Window functions
What: apply transformations over part of a table
Why: use cases abound!
Window functions
What: apply transformations over part of a table
Why: use cases abound!
user_id happened_at page_path
1 2021-01-01 /product
1 2021-01-02 /signup
2 2021-01-03 /app
pageviews
Window functions
What: apply transformations over part of a table
Why: use cases abound!
user_id happened_at page_path
1 2021-01-01 /product
1 2021-01-02 /signup
2 2021-01-03 /docs
pageviews
user_id first_page_path
1 /product
2 /docs
user_touches
Helpful window functions
● first_value
● last_value
● lag
● lead
● row_number
● rank
● sum
● min
● max
● avg
● count
When you write a lot of SQL...
SQL: The bad parts
● No “functions” for code reuse
● Lots of typing → lots of typos
● It might be the most copy/pasted language of all time!
○ Citation needed
● But…. what if we add templating?
● Yes!
● Accessibility is 🔑
● What happens when you teach people SQL?
○ Data (engineers|scientists|analysts) can collaborate in code
○ Non-engineers are empowered to understand business logic
○ More people can contribute!
You can do it in SQL… but should you?
What does the future hold?
● More data workloads will converge around SQL
● Databases will improve support for sophisticated SQL operations
- AI & ML?
- Streaming?
- ….?
● More roles will require SQL knowledge and aptitude
● More & better tools will exist to aid in writing and managing SQL
What do you think?

Contenu connexe

Tendances

SQL Analytics Powering Telemetry Analysis at Comcast
SQL Analytics Powering Telemetry Analysis at ComcastSQL Analytics Powering Telemetry Analysis at Comcast
SQL Analytics Powering Telemetry Analysis at Comcast
Databricks
 
Advanced Model Comparison and Automated Deployment Using ML
Advanced Model Comparison and Automated Deployment Using MLAdvanced Model Comparison and Automated Deployment Using ML
Advanced Model Comparison and Automated Deployment Using ML
Databricks
 
The Future of Data Science and Machine Learning at Scale: A Look at MLflow, D...
The Future of Data Science and Machine Learning at Scale: A Look at MLflow, D...The Future of Data Science and Machine Learning at Scale: A Look at MLflow, D...
The Future of Data Science and Machine Learning at Scale: A Look at MLflow, D...
Databricks
 
Northwestern Mutual Journey – Transform BI Space to Cloud
Northwestern Mutual Journey – Transform BI Space to CloudNorthwestern Mutual Journey – Transform BI Space to Cloud
Northwestern Mutual Journey – Transform BI Space to Cloud
Databricks
 
Accelerating Deep Learning Training with BigDL and Drizzle on Apache Spark wi...
Accelerating Deep Learning Training with BigDL and Drizzle on Apache Spark wi...Accelerating Deep Learning Training with BigDL and Drizzle on Apache Spark wi...
Accelerating Deep Learning Training with BigDL and Drizzle on Apache Spark wi...
Databricks
 

Tendances (20)

SQL Analytics Powering Telemetry Analysis at Comcast
SQL Analytics Powering Telemetry Analysis at ComcastSQL Analytics Powering Telemetry Analysis at Comcast
SQL Analytics Powering Telemetry Analysis at Comcast
 
Databricks + Snowflake: Catalyzing Data and AI Initiatives
Databricks + Snowflake: Catalyzing Data and AI InitiativesDatabricks + Snowflake: Catalyzing Data and AI Initiatives
Databricks + Snowflake: Catalyzing Data and AI Initiatives
 
Monitoring Half a Million ML Models, IoT Streaming Data, and Automated Qualit...
Monitoring Half a Million ML Models, IoT Streaming Data, and Automated Qualit...Monitoring Half a Million ML Models, IoT Streaming Data, and Automated Qualit...
Monitoring Half a Million ML Models, IoT Streaming Data, and Automated Qualit...
 
The Rise of Vector Data
The Rise of Vector DataThe Rise of Vector Data
The Rise of Vector Data
 
Accelerate Data Science Initiatives: Databricks & Privacera
Accelerate Data Science Initiatives: Databricks & PrivaceraAccelerate Data Science Initiatives: Databricks & Privacera
Accelerate Data Science Initiatives: Databricks & Privacera
 
Advanced Model Comparison and Automated Deployment Using ML
Advanced Model Comparison and Automated Deployment Using MLAdvanced Model Comparison and Automated Deployment Using ML
Advanced Model Comparison and Automated Deployment Using ML
 
Consolidating MLOps at One of Europe’s Biggest Airports
Consolidating MLOps at One of Europe’s Biggest AirportsConsolidating MLOps at One of Europe’s Biggest Airports
Consolidating MLOps at One of Europe’s Biggest Airports
 
Leveraging Apache Spark to Develop AI-Enabled Products and Services at Bosch
Leveraging Apache Spark to Develop AI-Enabled Products and Services at BoschLeveraging Apache Spark to Develop AI-Enabled Products and Services at Bosch
Leveraging Apache Spark to Develop AI-Enabled Products and Services at Bosch
 
Getting Started with Databricks SQL Analytics
Getting Started with Databricks SQL AnalyticsGetting Started with Databricks SQL Analytics
Getting Started with Databricks SQL Analytics
 
Massive Data Processing in Adobe Using Delta Lake
Massive Data Processing in Adobe Using Delta LakeMassive Data Processing in Adobe Using Delta Lake
Massive Data Processing in Adobe Using Delta Lake
 
Accelerate Your ML Pipeline with AutoML and MLflow
Accelerate Your ML Pipeline with AutoML and MLflowAccelerate Your ML Pipeline with AutoML and MLflow
Accelerate Your ML Pipeline with AutoML and MLflow
 
The Future of Data Science and Machine Learning at Scale: A Look at MLflow, D...
The Future of Data Science and Machine Learning at Scale: A Look at MLflow, D...The Future of Data Science and Machine Learning at Scale: A Look at MLflow, D...
The Future of Data Science and Machine Learning at Scale: A Look at MLflow, D...
 
Accelerating Machine Learning on Databricks Runtime
Accelerating Machine Learning on Databricks RuntimeAccelerating Machine Learning on Databricks Runtime
Accelerating Machine Learning on Databricks Runtime
 
Northwestern Mutual Journey – Transform BI Space to Cloud
Northwestern Mutual Journey – Transform BI Space to CloudNorthwestern Mutual Journey – Transform BI Space to Cloud
Northwestern Mutual Journey – Transform BI Space to Cloud
 
Accelerating Deep Learning Training with BigDL and Drizzle on Apache Spark wi...
Accelerating Deep Learning Training with BigDL and Drizzle on Apache Spark wi...Accelerating Deep Learning Training with BigDL and Drizzle on Apache Spark wi...
Accelerating Deep Learning Training with BigDL and Drizzle on Apache Spark wi...
 
Databricks Overview for MLOps
Databricks Overview for MLOpsDatabricks Overview for MLOps
Databricks Overview for MLOps
 
Democratizing Data
Democratizing DataDemocratizing Data
Democratizing Data
 
A High Performance Mutable Engagement Activity Delta Lake
A High Performance Mutable Engagement Activity Delta LakeA High Performance Mutable Engagement Activity Delta Lake
A High Performance Mutable Engagement Activity Delta Lake
 
Semantic Image Logging Using Approximate Statistics & MLflow
Semantic Image Logging Using Approximate Statistics & MLflowSemantic Image Logging Using Approximate Statistics & MLflow
Semantic Image Logging Using Approximate Statistics & MLflow
 
Simplifying Disaster Recovery with Delta Lake
Simplifying Disaster Recovery with Delta LakeSimplifying Disaster Recovery with Delta Lake
Simplifying Disaster Recovery with Delta Lake
 

Similaire à You Can Do It in SQL

Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan
 
Map Reduce amrp presentation
Map Reduce amrp presentationMap Reduce amrp presentation
Map Reduce amrp presentation
renjan131
 
CV_Anantha_Krishnan_Senior_Oracle_ETL_PLSQL
CV_Anantha_Krishnan_Senior_Oracle_ETL_PLSQLCV_Anantha_Krishnan_Senior_Oracle_ETL_PLSQL
CV_Anantha_Krishnan_Senior_Oracle_ETL_PLSQL
Anantha TMS
 
Agile Data Warehousing
Agile Data WarehousingAgile Data Warehousing
Agile Data Warehousing
Davide Mauri
 

Similaire à You Can Do It in SQL (20)

Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
 
Recommender Systems from A to Z – Real-Time Deployment
Recommender Systems from A to Z – Real-Time DeploymentRecommender Systems from A to Z – Real-Time Deployment
Recommender Systems from A to Z – Real-Time Deployment
 
Move a successful onpremise oltp application to the cloud
Move a successful onpremise oltp application to the cloudMove a successful onpremise oltp application to the cloud
Move a successful onpremise oltp application to the cloud
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
BI on Big Data Presentation
BI on Big Data PresentationBI on Big Data Presentation
BI on Big Data Presentation
 
E-Commerce Product Rating Based on Customer Review
E-Commerce Product Rating Based on Customer ReviewE-Commerce Product Rating Based on Customer Review
E-Commerce Product Rating Based on Customer Review
 
Mr bi amrp
Mr bi amrpMr bi amrp
Mr bi amrp
 
What's new in VisibleThread 3.0
What's new in VisibleThread 3.0What's new in VisibleThread 3.0
What's new in VisibleThread 3.0
 
Project report
Project report Project report
Project report
 
Evolutionary db development
Evolutionary db development Evolutionary db development
Evolutionary db development
 
Dax & sql in power bi
Dax & sql in power biDax & sql in power bi
Dax & sql in power bi
 
A case for teaching SQL to scientists
A case for teaching SQL to scientistsA case for teaching SQL to scientists
A case for teaching SQL to scientists
 
Map Reduce amrp presentation
Map Reduce amrp presentationMap Reduce amrp presentation
Map Reduce amrp presentation
 
Library management system project
Library management system projectLibrary management system project
Library management system project
 
CV_Anantha_Krishnan_Senior_Oracle_ETL_PLSQL
CV_Anantha_Krishnan_Senior_Oracle_ETL_PLSQLCV_Anantha_Krishnan_Senior_Oracle_ETL_PLSQL
CV_Anantha_Krishnan_Senior_Oracle_ETL_PLSQL
 
Agile Data Warehousing
Agile Data WarehousingAgile Data Warehousing
Agile Data Warehousing
 
Ganesh profile
Ganesh profileGanesh profile
Ganesh profile
 
AWS re:Invent 2016: Automating Workflows for Analytics Pipelines (DEV401)
AWS re:Invent 2016: Automating Workflows for Analytics Pipelines (DEV401)AWS re:Invent 2016: Automating Workflows for Analytics Pipelines (DEV401)
AWS re:Invent 2016: Automating Workflows for Analytics Pipelines (DEV401)
 
Real-life Customer Cases using Data Vault and Data Warehouse Automation
Real-life Customer Cases using Data Vault and Data Warehouse AutomationReal-life Customer Cases using Data Vault and Data Warehouse Automation
Real-life Customer Cases using Data Vault and Data Warehouse Automation
 
Ebook9
Ebook9Ebook9
Ebook9
 

Plus de Databricks

Democratizing Data Quality Through a Centralized Platform
Democratizing Data Quality Through a Centralized PlatformDemocratizing Data Quality Through a Centralized Platform
Democratizing Data Quality Through a Centralized Platform
Databricks
 
Stage Level Scheduling Improving Big Data and AI Integration
Stage Level Scheduling Improving Big Data and AI IntegrationStage Level Scheduling Improving Big Data and AI Integration
Stage Level Scheduling Improving Big Data and AI Integration
Databricks
 
Simplify Data Conversion from Spark to TensorFlow and PyTorch
Simplify Data Conversion from Spark to TensorFlow and PyTorchSimplify Data Conversion from Spark to TensorFlow and PyTorch
Simplify Data Conversion from Spark to TensorFlow and PyTorch
Databricks
 
Raven: End-to-end Optimization of ML Prediction Queries
Raven: End-to-end Optimization of ML Prediction QueriesRaven: End-to-end Optimization of ML Prediction Queries
Raven: End-to-end Optimization of ML Prediction Queries
Databricks
 
Processing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache SparkProcessing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache Spark
Databricks
 

Plus de Databricks (20)

DW Migration Webinar-March 2022.pptx
DW Migration Webinar-March 2022.pptxDW Migration Webinar-March 2022.pptx
DW Migration Webinar-March 2022.pptx
 
Data Lakehouse Symposium | Day 1 | Part 1
Data Lakehouse Symposium | Day 1 | Part 1Data Lakehouse Symposium | Day 1 | Part 1
Data Lakehouse Symposium | Day 1 | Part 1
 
Data Lakehouse Symposium | Day 1 | Part 2
Data Lakehouse Symposium | Day 1 | Part 2Data Lakehouse Symposium | Day 1 | Part 2
Data Lakehouse Symposium | Day 1 | Part 2
 
Data Lakehouse Symposium | Day 2
Data Lakehouse Symposium | Day 2Data Lakehouse Symposium | Day 2
Data Lakehouse Symposium | Day 2
 
Data Lakehouse Symposium | Day 4
Data Lakehouse Symposium | Day 4Data Lakehouse Symposium | Day 4
Data Lakehouse Symposium | Day 4
 
5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop
5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop
5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop
 
Democratizing Data Quality Through a Centralized Platform
Democratizing Data Quality Through a Centralized PlatformDemocratizing Data Quality Through a Centralized Platform
Democratizing Data Quality Through a Centralized Platform
 
Learn to Use Databricks for Data Science
Learn to Use Databricks for Data ScienceLearn to Use Databricks for Data Science
Learn to Use Databricks for Data Science
 
Why APM Is Not the Same As ML Monitoring
Why APM Is Not the Same As ML MonitoringWhy APM Is Not the Same As ML Monitoring
Why APM Is Not the Same As ML Monitoring
 
The Function, the Context, and the Data—Enabling ML Ops at Stitch Fix
The Function, the Context, and the Data—Enabling ML Ops at Stitch FixThe Function, the Context, and the Data—Enabling ML Ops at Stitch Fix
The Function, the Context, and the Data—Enabling ML Ops at Stitch Fix
 
Stage Level Scheduling Improving Big Data and AI Integration
Stage Level Scheduling Improving Big Data and AI IntegrationStage Level Scheduling Improving Big Data and AI Integration
Stage Level Scheduling Improving Big Data and AI Integration
 
Simplify Data Conversion from Spark to TensorFlow and PyTorch
Simplify Data Conversion from Spark to TensorFlow and PyTorchSimplify Data Conversion from Spark to TensorFlow and PyTorch
Simplify Data Conversion from Spark to TensorFlow and PyTorch
 
Scaling your Data Pipelines with Apache Spark on Kubernetes
Scaling your Data Pipelines with Apache Spark on KubernetesScaling your Data Pipelines with Apache Spark on Kubernetes
Scaling your Data Pipelines with Apache Spark on Kubernetes
 
Scaling and Unifying SciKit Learn and Apache Spark Pipelines
Scaling and Unifying SciKit Learn and Apache Spark PipelinesScaling and Unifying SciKit Learn and Apache Spark Pipelines
Scaling and Unifying SciKit Learn and Apache Spark Pipelines
 
Sawtooth Windows for Feature Aggregations
Sawtooth Windows for Feature AggregationsSawtooth Windows for Feature Aggregations
Sawtooth Windows for Feature Aggregations
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkRedis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
 
Re-imagine Data Monitoring with whylogs and Spark
Re-imagine Data Monitoring with whylogs and SparkRe-imagine Data Monitoring with whylogs and Spark
Re-imagine Data Monitoring with whylogs and Spark
 
Raven: End-to-end Optimization of ML Prediction Queries
Raven: End-to-end Optimization of ML Prediction QueriesRaven: End-to-end Optimization of ML Prediction Queries
Raven: End-to-end Optimization of ML Prediction Queries
 
Processing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache SparkProcessing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache Spark
 
Machine Learning CI/CD for Email Attack Detection
Machine Learning CI/CD for Email Attack DetectionMachine Learning CI/CD for Email Attack Detection
Machine Learning CI/CD for Email Attack Detection
 

Dernier

Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
amitlee9823
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
JoseMangaJr1
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 

You Can Do It in SQL

  • 1. You can do it in SQL
  • 2. Drew Banin (he/him) Chief Product Officer 2 mo’ data mo’ problems @drewbanin on Twitter
  • 3. ● Open core data modeling software ● dbt provides a SQL-first workflow for: - Data modeling - Data testing - Data documentation - And more! You can learn more at getdbt.com We’re the makers of dbt
  • 4. Confessions & disclaimers ● I have never written a line of production Scala code in my life ● I have written a whole lot of SQL in my life ● People who tolerate Python packaging don’t get to complain about the JVM
  • 5. I ❤ SQL , Expressive , Accessible , Universal , Declarative , Thought provoking….?
  • 6. I ❤ SQL , Expressive - SQL reads more or less like a real sentence , Accessible , Universal , Declarative , Thought provoking….?
  • 7. I ❤ SQL , Expressive , Accessible - Lots of people can learn in pretty quickly , Universal , Declarative , Thought provoking….?
  • 8. I ❤ SQL , Expressive , Accessible , Universal - Most databases speak SQL with pretty consistent support , Declarative , Thought provoking….?
  • 9. I ❤ SQL , Expressive , Accessible , Universal , Declarative - No moving parts, limited opportunities for the bad kind of magic , Thought provoking….?
  • 10. I ❤ SQL , Expressive , Accessible , Universal , Declarative , Thought provoking….?
  • 11. Some things you can do in SQL
  • 13. What: convert rows of data into columns of data Why: to derive new metrics from existing rows in a table Pivoting columns
  • 14. What: convert rows of data into columns of data Why: to derive new metrics from existing rows in a table Pivoting columns user_id event_name happened_at 1 signup 2021-01-01 1 purchase 2021-01-02 2 signup 2021-01-03 3 signup 2021-01-04 3 purchase 2021-01-05 1 purchase 2021-01-05
  • 15. What: convert rows of data into columns of data Why: to derive new metrics from existing rows in a table Pivoting columns user_id event_name happened_at 1 signup 2021-01-01 1 purchase 2021-01-02 2 signup 2021-01-03 3 signup 2021-01-04 3 purchase 2021-01-05 1 purchase 2021-01-05
  • 16. What: convert rows of data into columns of data Why: to derive new metrics from existing rows in a table Pivoting columns user_id event_name happened_at 1 signup 2021-01-01 1 purchase 2021-01-02 2 signup 2021-01-03 3 signup 2021-01-04 3 purchase 2021-01-05 1 purchase 2021-01-05 user_id signup_date purchases 1 2021-01-01 2 2 2021-01-02 0 3 2021-01-04 1
  • 17.
  • 19. Unions What: append tables together Why: combine tables into a taller table
  • 20. Unions What: append tables together Why: combine tables into a taller table user_id event_name happened_at 1 signup 2021-01-01 1 purchase 2021-01-02 2 signup 2021-01-03 user_id event_name happened_at 1 app_install 2021-01-01 1 screen_view 2021-01-02 2 app_install 2021-01-03 web_events mobile_events
  • 21. Unions What: append tables together Why: combine tables into a taller table source user_id event_name happened_at mobile 1 app_install 2021-01-01 mobile 1 screen_view 2021-01-02 mobile 2 app_install 2021-01-03 web 1 signup 2021-01-01 web 1 purchase 2021-01-02 web 2 signup 2021-01-03 all_events
  • 22.
  • 24. Window functions What: apply transformations over part of a table Why: use cases abound!
  • 25. Window functions What: apply transformations over part of a table Why: use cases abound! user_id happened_at page_path 1 2021-01-01 /product 1 2021-01-02 /signup 2 2021-01-03 /app pageviews
  • 26. Window functions What: apply transformations over part of a table Why: use cases abound! user_id happened_at page_path 1 2021-01-01 /product 1 2021-01-02 /signup 2 2021-01-03 /docs pageviews user_id first_page_path 1 /product 2 /docs user_touches
  • 27.
  • 28. Helpful window functions ● first_value ● last_value ● lag ● lead ● row_number ● rank ● sum ● min ● max ● avg ● count
  • 29. When you write a lot of SQL...
  • 30. SQL: The bad parts ● No “functions” for code reuse ● Lots of typing → lots of typos ● It might be the most copy/pasted language of all time! ○ Citation needed ● But…. what if we add templating?
  • 31.
  • 32.
  • 33. ● Yes! ● Accessibility is 🔑 ● What happens when you teach people SQL? ○ Data (engineers|scientists|analysts) can collaborate in code ○ Non-engineers are empowered to understand business logic ○ More people can contribute! You can do it in SQL… but should you?
  • 34. What does the future hold? ● More data workloads will converge around SQL ● Databases will improve support for sophisticated SQL operations - AI & ML? - Streaming? - ….? ● More roles will require SQL knowledge and aptitude ● More & better tools will exist to aid in writing and managing SQL
  • 35. What do you think?