Summary
In this chapter, we learned about some advanced SQL concepts and features, such as CTEs and window functions. These features, for example, allow us to implement a logic that wouldn't be possible otherwise, that is, recursive queries.
The other techniques explained here, such as the DISTINCT ON clause, grouping sets, the FILTER clause, and lateral subqueries, could be replaced by simple structures. However, that would require a lot of coding, and the result would be more complex and would work more slowly.
SQL can be used to implement very complicated logic. However, in difficult cases, queries can become overcomplicated and hard to maintain. Moreover, sometimes, it isn't possible to do certain things in pure SQL. In these cases, you ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access