17 May 2022 Tihomir Babic Top 9 SQL GROUP BY Interview Questions Preparing for an SQL job interview? This guide will walk you through nine basic, intermediate, and advanced GROUP BY questions that you may have to answer. There are common GROUP BY questions that pop up in a lot of SQL job interviews; in this article, we’ll explain how to answer them. If you are a data analyst or another data professional preparing for an interview, this article aims to help you out. Read more 12 May 2022 Tihomir Babic What Are Window Functions in SQL? In this article, we discuss what window functions are and how they help you do your job as a data analyst or specialist. No, window functions have nothing to do with the operating system. The window here refers to a set of rows over which the function aggregates data. To learn how window functions work, what functions there are, and how to apply them to real-world problems, it’s best to take the Window Functions course. Read more 24 Mar 2022 Tihomir Babic How to Write Multiple CTEs in SQL In this article, I will show you how to leverage the power of multiple CTEs (Common Table Expressions) by combining two or more in a single SQL query. I’ll explain how this technique can simplify complex queries, improve readability, and enhance efficiency when working with large datasets. Common table expressions, or CTEs, can be a powerful SQL tool. When you write two (or even more) CTEs together, this power multiplies. Read more 22 Mar 2022 Tihomir Babic The SQL Substring Function in 5 Examples Working with text data in SQL? We explain how to get values from any point in a string. When you think of working with data in SQL, your first thought is probably a database full of numbers and your SQL code doing very fancy calculations. But text is data, too! It’s very common to find text data in databases. Not only do you have to extract it, but often you also have to manipulate it. Read more 10 Feb 2022 Tihomir Babic How to Query a Parent-Child Tree in SQL What are parent-child tree structures in SQL? In this article, we answer that question, talk about query hierarchy, and demonstrate the five most common SQL queries you’ll need for these data structures. Yes, you can use SQL on a parent-child tree structure. I’ll show you how in this article. Along the way, I’ll walk you through five query examples, starting with the easiest and ending with the most complex. Read more 25 Jan 2022 Tihomir Babic The SQL OVER() Clause Explained Here is a detailed explanation of the OVER() clause in SQL window functions. This is a detailed guide on using the OVER() clause in SQL window functions. I will focus specifically on this clause, which requires that you have at least a general idea of how window functions work. To make the best out of this article, take a look at the SQL Window Functions Cheat Sheet. Feel free to have it by your side as we go. Read more 30 Dec 2021 Tihomir Babic How to Include Zero in a COUNT() Aggregate Explaining how to include zero (0) counts in your SQL query result. Here’s the problem: you want to count something that doesn’t exist, and you want to show your result as zero. How do you do that in SQL? Using the COUNT() aggregate function is a reasonable first step. It will count all the data it finds and return the number of occurrences. But what if there are no occurrences of certain data? Read more 9 Dec 2021 Tihomir Babic How to Join Tables in SQL Without Using JOINs Here’s how you can combine tables without the JOIN keyword. It seems like it shouldn’t be possible: join tables in SQL without using the JOIN keyword. But using the JOIN keyword is not the only way to join tables in SQL. This article will show you two additional methods for joining tables. Neither of them requires the JOIN keyword to work. They are: Using a comma between the table names in the FROM clause and specifying the joining condition in a WHERE Using UNION and UNION ALL. Read more 24 Nov 2021 Tihomir Babic Top 5 SQL CTE Interview Questions Here are five questions (and solutions!) on CTEs you’ll (probably) be asked at an interview. I’m not saying you will get these SQL CTE interview questions at every job interview. But when you do, they are probably along the lines of the five I’m about to show here. Other than theoretical questions about CTEs, there are not that many variations in the CTE scenarios evaluated by interviewers. Go through these five examples, and you get a good foundation for acing your interview! Read more 19 Oct 2021 Tihomir Babic What Is a Recursive CTE in SQL? The article that’ll show you practical examples of using recursive CTEs in SQL. If you’ve heard about SQL’s recursive CTEs but never used them, this article is for you. It’s also for you if you never get tired of recursive CTE examples. Before we dig into recursion, I’ll remind you what CTEs are and what their syntax is. Then I’ll do the same for recursive CTEs. After that, I’ll show you how recursive CTEs work in three examples. Read more «« « 1 2 3 4 5 6 … 9 » »»