15 Sep 2020 Kateryna Koidan GROUP BY in SQL Explained The SQL GROUP BY statement is easy to use, but it can be hard to master. Learn what you can do with GROUP BY, how it works, and how to use it with aggregate functions. GROUP BY is one of the basic SQL tools. However, it might be difficult for beginners to understand how GROUP BY works and how it is used to compute statistics with different aggregate functions. In this article, I’ll use several examples to show exactly how GROUP BY organizes rows and how aggregate functions can be used to calculate statistics on one or more columns. Read more 26 Aug 2020 Kateryna Koidan SQL CTEs Explained with Examples Learn how you can leverage the power of Common Table Expressions (CTEs) to improve the organization and readability of your SQL queries. The commonly used abbreviation CTE stands for Common Table Expression. To learn about SQL Common Table Expressions through practice, I recommend the interactive Recursive Queries course at LearnSQL.com. It contains over 100 hands-on exercises on simple and complex recursive CTEs. What does a CTE do? Why might you want to use one in your SQL code? Read more 6 Aug 2020 Kateryna Koidan Can you Join two Tables Without a Common Column? Yes, you can! The longer answer is yes, there are a few ways to combine two tables without a common column, including CROSS JOIN (Cartesian product) and UNION. The latter is technically not a join but can be handy for merging tables in SQL. In this article, I’ll guide you through the different solutions with examples. When Do you Need to Join Tables Without a Common Column? Beginners just getting started with SQL are usually introduced to standard equi joins, in which two tables are combined by a common column. Read more 24 Jul 2020 Kateryna Koidan What's the Difference Between Multiple Tables in FROM and Using JOIN? What’s your approach to joining tables in SQL? In this article, we discuss two approaches and explain why many SQL developers have a definite preference for JOIN. Do you prefer to list multiple tables in FROM and use WHERE to set the join conditions? Or do you use the JOIN keyword? SQL supports both, but there are significant differences between them. Let’s look at each one in detail and then discuss why JOIN is generally preferred. Read more 30 Jun 2020 Kateryna Koidan How ORDER BY and NULL Work Together in SQL Do NULL values come first or last when you use ORDER BY? Are they considered higher or lower than non-NULL values? In this article, I’ll explain how different relational databases treat NULL values when sorting output and how to change the default behavior of the ORDER BY clause. When LearnSQL users practice the ORDER BY clause in our SQL Basics course, they often ask why NULL values appear first in the output and how they can change this behavior. Read more 9 Jun 2020 Kateryna Koidan Practical Examples of When to Use Non-Equi JOINs in SQL If you think that two tables in SQL can be joined only using the common field, you will be excited to learn that there are other ways of joining. Non-equi JOINs use different kinds of comparison operators in the JOIN condition. In this article, I’ll guide you through non-equi JOIN examples to show the common use cases for this type of JOIN. Equi JOIN vs. Non-Equi JOIN How do you usually join two tables in SQL? Read more 29 May 2020 Kateryna Koidan What Are the Different Types of SQL Subqueries? Subqueries can be used in many business cases. What subquery types does SQL offer? And how can you use them efficiently? In this article, I’ll guide you through different subquery types and the typical situations when they are useful. What Is an SQL Subquery? A subquery, or nested query, is a query placed within another SQL query. There are many different scenarios where you may want to include a query in the WHERE, FROM, or SELECT clauses of your main query. Read more 7 May 2020 Kateryna Koidan What Is a Nested Query in SQL? Updated on: July 31, 2024 Have you ever wished that you could build a query with several SELECT statements? Good news! You can do this – and a lot more – with SQL’s nested queries. Nested queries are an essential part of writing efficient SQL code. If you’ve been learning SQL and writing queries, you’ve likely faced situations where you need to put a SELECT statement inside another SELECT statement. You might wonder, " Read more 30 Apr 2020 Kateryna Koidan Is SQL a Programming Language? Updated on: October 30th, 2023 SQL is a powerful tool for communicating with database management systems. When you write SQL queries, you give instructions to the computer and it performs these instructions—it sounds like programming. However, you cannot build an application with SQL as you can with Python or Java. So, is SQL a programming language? For over 50 years, SQL, or Structured Query Language, has been a cornerstone in the world of data management. Read more 10 Mar 2020 Kateryna Koidan How to LEFT JOIN Multiple Tables in SQL Can you LEFT JOIN three tables in SQL? Yes, indeed! You can use multiple LEFT JOINs in one query if needed for your analysis. In this article, I will go through some examples to demonstrate how to LEFT JOIN multiple tables in SQL and how to avoid some common pitfalls when doing so. The best way to practice different types of joins is our interactive SQL JOINs course. It contains over 90 hands-on exercises that cover simple 2-table joins, joining multiple tables, LEFT JOIN, FULL JOIN, and many more. Read more «« « 1 2 3 4 5 » »»