Do you want to be able to process trees and graphs in MySQL? Are you using MySQL 8 or higher? Learn how to write recursive queries and you’ll soon be producing concise and powerful SQL queries!
This interactive online MySQL course will teach you how to use Common Table Expressions (CTEs) and recursive queries in MySQL 8 and up. If you are serious about working with databases and becoming a SQL expert, you need to know these features.
Recursive SQL queries let you process hierarchical structures (such as management hierarchies, family trees, or road connection graphs) in SQL. When you understand recursion, you can easily work with trees and graphs stored in a MySQL database.
CTEs (Common Table Expressions, also known as WITH queries), are essentially named subqueries. They let you organize your SQL query and name parts of it; this makes your work clearer and more readable. CTEs also let you organize computations into multiple phases, which makes long queries more understandable.
Common Table Expressions and recursive queries were introduced to MySQL in 2018; they are now available in version 8.0 and higher. After completing this online MySQL course, you will be able to use the acquired knowledge in work with other SQL databases; just check minor syntax differences in your database’s documentation.
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.
The course is interactive. You practice by writing real SQL code and solving exercises directly in your web browser. Our online platform runs your code and verifies your solution. You don't need to install any software on your computer.
This course is intended for intermediate users. We assume that you know the basics of SQL, including:
If you are new to MySQL, start with our SQL Basics in MySQL course and come back to this course when you’re comfortable with those concepts.
You will discover how to:
Test your knowledge of SQL.
Your first encounter with Common Table Expressions
You'll get to know how to use nested CTEs
You'll find out what recursion is and how to use it in SQL queries
You'll get to know how to use INSERT, DELETE, UPDATE statements with CTEs
Test your knowledge in this final quiz