Date: July 31, 2022
Quiz What is the top channel used by each account to market products? How often was that same channel used? However, we will need to do two aggregations and two subqueries to make this happen. Let’s find the number of times each channel is used by each account. So we will need to count the number of … Read More
Date: July 31, 2022
Simple the inner subquery is completely independent from the outer query Correlated the inner subquery is dependent on a clause in the outer query The second concept to consider before writing any code is the dependency of your subquery to the larger query. A subquery can either be simple or correlated. In my experience, it’s … Read More
Date: July 31, 2022
Inline Subquery creates a table that you could then query again in the FROM statement Expert Tip Note that you should not include an alias when you write a subquery in a conditional statement. This is because the subquery is treated as an individual value (or set of values in the IN case) rather than as a table. Nested and … Read More
Date: July 30, 2022
The first concept that helps when thinking about the format of a subquery is the placement of it: with, nested, inline, or scalar. The second concept to consider is an indentation, which helps heighten readability for your future self or other users that want to leverage your code. Badly Formatted Queries Though these poorly formatted … Read More
Date: July 30, 2022
Nested query within another query embedded within the WHERE clause when a user wants to filter an output using a condition met from another table advantageous for readability Use Case for a Nested Subquery When a user wants to filter an output using a condition met from another table. This type of placement also has advantages … Read More