Articles Cookbook

Author: Kamil Bladoszewski

Kamil works as a Java developer and is a machine learning hobbyist. He loves clean code and turning interesting data into effective charts. His goal of giving people access to knowledge is fulfilled by being a member of the ML in PL Association, an organization that supports the machine learning community in Poland. In his free time, he likes playing computer games.

Subquery vs. CTE: A SQL Primer

Have you ever wondered about the differences between a subquery and a common table expression (CTE) in SQL? The concepts seem very similar, but knowing the difference – and when to use each one – will help you write efficient and readable queries. First, we’ll explain the concepts underlying subqueries and CTEs. Then we’ll look at a few examples and finally analyze the pros and cons of each technique.

How to Join 3 Tables (or More) in SQL

Using JOIN in SQL doesn’t mean you can only join two tables. You can join 3, 4, or even more! The possibilities are limitless. If you’ve just learnt JOINs in SQL, you might think that it’s limited to two tables. That’s not surprising – this concept can be hard to understand, and the idea that JOINs can get even more complicated may be really scary at first. The truth is that you can easily extend this idea to three tables or even more.

How to Rank Rows in SQL: A Complete Guide

Don’t struggle with SQL ranking functions anymore! This article will guide you through the most common ranking use cases. Rankings are used around us every day. Sports tournaments, the best movies and TV series on Netflix, stores with the cheapest products—these are only a few examples of rankings you might’ve seen recently. Using SQL RANK functions might be hard sometimes. The variety of different constructions is enormous. You can easily get lost in everything there is to learn about ranking.