Advanced SQL for Data Scientists

Advanced SQL for Data Scientists

2h 31mAdvanced2021-05-27

Authors

Dan Sullivan

Dan Sullivan

Enterprise Architect, Big Data Expert

Course details

Many data scientists know how to work with SQL—the industry-standard language for data analysis. But as data sizes grow, you need to know how to do more than simply read and write from a database. This course provides a more sophisticated approach to designing data models and optimizing queries in SQL. Instructor Dan Sullivan begins with the logical and physical design of tables—with particular focus on very large databases—and then presents a deep dive review of indexes, including specialized indexes and when to use them. The next section introduces query optimization and shows how to optimize basic, multi-join, and more complex queries. The course also covers SQL extensions, including user-defined functions and specialized data types. The techniques taught here enable more efficient analysis of large data sets using SQL, statistics, and custom business logic.

Skills covered

PostgreSQLSQLDatabase AdministrationDatabase DevelopmentDatabase ManagementPersonaData AnalysisProgramming LanguagesData ScienceBusiness Analysis and StrategyBusiness Software and ToolsOpen SourceSoftware Development

Concepts

Introduction

  • Advanced SQL techniques for data science
  • What you should know

Data Modeling - Tables

  • Rules of normalization
  • Denormalization
  • Partitioning data
  • Materialized views
  • Read replicas
  • Challenge - Design a data model for analytics
  • Solution - Design a data model for analytics

Data Modeling - Indexes

  • B-tree indexes
  • Bitmap indexes
  • Hash indexes
  • GiST and SP-GiST indexes
  • GIN and BRIN indexes
  • Challenge - Choosing an optimal indexing strategy
  • Solution - Choosing an optimal indexing strategy

Query Optimization

  • EXPLAIN and ANALYZE commands
  • Generating data with generate sequence
  • Generating time series data
  • Analyzing a query with WHERE clauses and indexes
  • Analyzing a query with a join
  • Challenge - Optimize a query using an explain plan
  • Solution - Optimize a query using an explain plan

User-Defined Functions

  • Extending SQL with user-defined functions
  • SQL query functions
  • Function overloading
  • Function volatility
  • PL Python functions
  • Challenge - Write a user-defined function
  • Solution - Write a user-defined function

Special-Purpose Functionality

  • Federated queries
  • Bloom filters
  • Hstore for key-value pairs
  • JSON for semi-structured data
  • Hierarchical data and ltrees
  • Challenge - Design a table to support unstructured data
  • Solution - Design a table to support unstructured data

Conclusion

  • Next steps
80,000 Toman