Welcome to our course Common Table Expressions.
Common Table Expressions (CTEs), often simply called
WITH clauses, are essentially just named subqueries. They are a fairly new feature of SQL; with CTEs, you can break a long query into smaller chunks, which makes it more readable. Unlike SQL subqueries, CTEs can be recursive, allowing the traversal of hierarchical models of enormous depth.
This course covers simple CTEs, nested CTEs, and recursive CTEs. You will learn how to manage your SQL queries with CTEs, how and when to nest CTEs, and how to use recursive CTEs to move through hierarchical data models.
In this first part of the course you will test your knowledge about basic SQL. You need fundamental SQL knowledge in order to follow this course, which covers more advanced material. We assume that you know how to filter rows in the table, sort data, and use aggregate functions with
GROUP BY and
HAVING predicates. You will also need skills in joining tables and in using subqueries and set operators.
Check your knowledge: start with our short quiz to test your SQL skills!