
Advance your SQL skills by transforming and classifying data with conditional expressions and window functions, and by combining data from multiple sources and breaking queries into subqueries.
Review the learning objectives, prepare data by loading two datasets into PostgreSQL, and learn to combine data with union, intersect, and except, joins, subqueries, case statements, and window functions.
Set up a PostgreSQL level two database, create a books schema and tables for books, users, and ratings, then load and verify CSV datasets for analysis.
Load and model ecommerce data by creating a commerce_schema with customers, products, suppliers, orders, order_reviews, order_items, and order_payments, and import CSVs using the copy command to map relational keys.
Discover how to combine data from multiple tables in a relational database using SQL operators such as union and intersect, with a later focus on the join operator.
Learn how to combine SQL results using union, intersect, and except, ensuring same column count, order, and compatible data types across queries.
Master how join operators merge data from multiple queries or tables, including inner, outer, and cost join, and understand the cartesian join's potential to produce a large number of rows.
Learn how inner join links two tables with a condition to return records with matching values, using keys, primary keys, and aliases for clarity.
Understand outer joins in SQL, including left, right, and full outer joins, to preserve unmatched rows from one table while enriching with related data from another.
Explore how subqueries unlock insights by nesting queries in SQL, enabling you to combine data from multiple related tables and build more complex, powerful analyses.
Explore what a subquery is, including inner and outer queries, how inner results feed the outer query, and how subqueries enable multi-table data extraction in select statements.
Use single-row subqueries to filter data with conditional logic, employing aggregate functions (average, maximum) to compare product weights and prices across tables.
Learn how to filter data with multiple-row subqueries using in, any, and all operators, including inner joins, with examples on books, ratings, and users.
Learn to use subqueries as inline views in the from clause to create a temporary, alias-named data source that simplifies complex queries, with an example using average book ratings.
Transform data with a simple case statement in SQL by mapping input expressions using when-then-else, demonstrated with gender values M and F to male and female.
Learn how to use a searched case expression to classify rows with flexible conditions, creating age groups and weight categories, then summarize results with group by and counts.
Discover window functions in SQL, learning to apply aggregates to groups while keeping each row, such as listing users with their city’s average age.
Assign sequential numbers within city partitions using the window function row_number over (partition by city order by age desc), highlighting oldest users per city and optionally top five.
Use the rank window function to assign equal ranks to rows with the same value inside a partition, replacing sequential numbers and noting that ties cause skipped ranks.
Explore two simple SQL tools to simplify complex queries: create virtual tables with views and use common table expressions (CTEs) to improve readability and troubleshooting.
Learn how views create virtual, dynamic tables to simplify complex queries and restrict sensitive data, with practical examples using case statements, unions, and masking columns.
Recap level two covers creating database instances and schemas, loading csv data, and analyzing data across tables with union, joins, sub queries, case statement, window functions, and common table expressions.
Data is Everywhere
It is not a secret that data is everywhere; data is collected, processed, and accumulated in massive databases across all industry domains. As the technologies for handling data are evolving rapidly, the industry challenge is more focused on data utilization than data collection and storage. As a result, many organizations are looking for the right mix of people, tools, and products to help them pick up those piles of data, extract valuable insights and constantly gain market advantage.
Becoming an SQL Wizard
SQL is the most popular language to extract, load, and query data from databases. If you master SQL, you gain the amazing and useful flexibility to explore, filter and aggregate almost any raw data in multiple dimensions. SQL Wizards are needed everywhere.
Level 2
The complete training program is divided into multiple sequential levels to let you grow your knowledge and understanding of SQL and data analysis.
Level 2 is a direct continuum of the topics we learned in level 1. It will extend your knowledge into more advanced SQL tools and capabilities. We will learn to combine data from multiple data sources, break complex queries into sub-queries, transform and classify data, analyze data with window functions, create views, CTEs, and more.
We will use quizzes and exercises to practice and sharpen your understanding of the learning objectives. In any case, I am here for any questions.
I wish you AWESOME learning and hope to see you inside!