3 Mar 2021 Kateryna Koidan How to JOIN Tables in SQL Do you need to display data stored in different tables? Then it’s time to use SQL JOINs! This can be a challenging topic for beginners, so I’ve prepared this comprehensive step-by-step guide on joining tables in SQL. Often, the information that you want to display is stored in several tables. In such cases, you’ll need to join these tables by specifying which rows should be combined with other rows. That’s exactly what JOIN does. Read more 11 Feb 2021 Kateryna Koidan Enumerate and Explain All the Basic Elements of an SQL Query “What are the basic elements of an SQL query?” is a popular SQL job interview question. In this article, we review the basic syntax of an SQL query. An SQL query, which requests information from a relational database, consists of several elements. These allow you to select specific columns from specific tables and to filter and sort this information if necessary. In this article, I’ll briefly review these elements by explaining what each element does and how to use it. Read more 9 Feb 2021 Kateryna Koidan What Does ORDER BY Do? When analyzing data, it often helps to have rows ordered in a specific way. In this article, I’ll use multiple examples to show how SQL ORDER BY sorts data according to one or more columns in ascending or descending order. Introduction to ORDER BY By default, the order of rows in the output of an SQL query is arbitrary. If you want to sort the output in a particular order, you’ll need to use the ORDER BY keyword. Read more 14 Jan 2021 Kateryna Koidan What’s the Difference Between SQL CTEs and Views? SQL views vs. CTEs: What do they do? How are they different? Which one should you use and when? Get your answers here! In SQL, both CTEs (common table expressions) and views help organize your queries, leading to cleaner and easier-to-follow code. However, there are some important differences between them. This article will walk you through several examples of CTEs and views and explain when to use each one. Read more 13 Jan 2021 Kateryna Koidan What Is LEFT JOIN in SQL? Get to know the details of LEFT JOIN, one of the most common SQL JOIN types. SQL is mainly about getting data from databases. Very often, you’ll need data to be combined from multiple tables in your database. That’s when JOINs come into play. LEFT JOIN is one of the JOIN types that you are likely to use very often. In this article, I’ll explain the syntax of LEFT JOIN and how it works using several examples and illustrations. Read more 3 Dec 2020 Kateryna Koidan How Do You Write a SELECT Statement in SQL? SQL is a language to communicate with relational databases, and the SELECT statement is the first thing you’ll learn when you start using SQL. In this article, you’ll learn how to write SELECT statements, from the basics to more advanced. What Is SQL? SQL stands for “Structured Query Language.” It has a long history that started in the 1970s. Being the standard for communication with relational databases, it has maintained its popularity. Read more 26 Nov 2020 Kateryna Koidan Aggregate Functions vs Window Functions: A Comparison If you aren’t familiar with SQL’s window functions, you may wonder how they differ from aggregate functions. When should you use window functions? In this article, we’ll review window functions and aggregate functions, examine their similarities and differences, and see which one to choose depending on what you need to do. After you’ve tackled basic SQL, you’ll probably want to get into some of its more advanced functions. That’s great; these functions make reporting and analysis easier. Read more 27 Oct 2020 Kateryna Koidan How to Fix a 'Not a GROUP BY Expression' Error Whether you are an experienced SQL user or only a beginner, your SQL queries may return errors. The accompanying messages are supposed to help you fix them; however, sometimes the messages are not very helpful. The Oracle message “Not a GROUP BY expression” is one such example. Let’s review what this is about and how to fix it. We are going to assume some basic understanding of how GROUP BY works. Read more 23 Oct 2020 Kateryna Koidan How to Learn SQL Common Table Expressions (CTEs) Common table expressions are very useful for organizing, traversing, and improving the readability of long SQL queries. Moreover, recursive CTEs, which can reference themselves, solve problems that cannot be addressed with other queries. But how do you master common table expressions in SQL? In this article, I discuss the most effective strategies for learning CTEs and suggest how to address the common challenges of learning common table expressions on your own. Read more 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 «« « 1 2 3 4 5 » »»