27 Oct 2022 Ignacio L. Bisso What Are the Basic SQL Queries? You can access the data in a database using some basic SQL queries. In this article, we review the fundamentals SQL queries every beginner should know. Databases are everywhere, and they contain different kinds of data. Almost all of them support SQL, a language that lets you read and manipulate the data inside a database. In this article, I’ll show you the basic SQL queries that you can use to perform many common everyday data tasks. Read more 29 Sep 2022 Ignacio L. Bisso How the WITH Clause Works in SQL Do you want to master complex SQL queries? Learn how to use the powerful WITH clause! In SQL, there are simple queries and complex queries. A simple query can take data from a table, apply a filter, and return the data as it is in the source table. A complex query may require complex transformations to the source data or may need to read and join data from multiple tables or views. Read more 30 Jun 2022 Ignacio L. Bisso Learn the OVER() Clause in SQL with 7 Examples Learn how to use the OVER() clause in your SQL queries and you will take a step forward in your SQL knowledge. Most data analysts and SQL developers have a good handle on the SELECT, FROM, WHERE, GROUP BY, and ORDER BY clauses. However, these clauses are only a limited subset of the SQL language. There are other clauses, such as OVER(), which allow us to create flexible SQL reports and add an enormous expressive power to the SQL language. Read more 24 May 2022 Ignacio L. Bisso How to Use the COALESCE() Function in SQL SQL users are often faced with NULL values in their queries and need to process them properly. The COALESCE() function helps handle NULL values. Read this article to learn how to use COALESCE() in your queries. SQL tables store data in records, and records are composed of fields. There can be situations where we don’t know the value for a specific field. For example, when we don’t know the marital status of a person, SQL allows us to assign a NULL for this field. Read more 31 Mar 2022 Ignacio L. Bisso How to Use the ROUND() Function in SQL Need to round numeric results in SQL? The ROUND() function is here to do the job. Modern relational databases offer many built-in functions that extend the capabilities of SQL. In this article, we will use practical examples to explain how the ROUND() function works. (Spoiler alert: If you guessed that it rounds a number to a certain decimal place, you’re right! Read on to find out more.) SQL Standard Functions Each SQL database (PostgreSQL, MySQL, Oracle, SQL Server among others) has a set of built-in functions. Read more 19 Jan 2022 Ignacio L. Bisso What Is a Common Table Expression (CTE) in SQL? The common table expression (CTE) is a powerful construct in SQL that helps simplify a query. CTEs work as virtual tables (with records and columns), created during the execution of a query, used by the query, and eliminated after query execution. A CTE is defined using a CTE query definition, which specifies the structure and content of the CTE. CTEs often act as a bridge to transform the data in source tables to the format expected by the query. Read more 23 Dec 2021 Ignacio L. Bisso How to Use the SQL PARTITION BY With OVER At the heart of every window function call is an OVER clause that defines how the windows of the records are built. Within the OVER clause, there may be an optional PARTITION BY subclause that defines the criteria for identifying which records to include in each window. Read on and take an important step in growing your SQL skills! What Is the PARTITION BY Clause in SQL? The SQL PARTITION BY expression is a subclause of the OVER clause, which is used in almost all invocations of window functions like AVG(), MAX(), and RANK(). Read more 29 Oct 2021 Ignacio L. Bisso What Is a Rolling Average and How Do You Compute It in SQL? In this article, we will show three different examples of using SQL to calculate rolling averages. Learn this and you will take an important step in your SQL growth! A rolling average is a metric that allows us to find trends that would otherwise be hard to detect. It is usually based on time series data. In SQL, we calculate rolling averages using window functions. First, let’s talk about what rolling averages are and why they’re useful. Read more 30 Sep 2021 Ignacio L. Bisso What Is the OVER() Clause in SQL? Window functions are one of SQL’s most powerful resources, but they are not frequently used by the average SQL developer. In this article, we will explain how you can define different kinds of window frames using the OVER clause. The OVER clause is essential to SQL window functions. Like aggregation functions, window functions perform calculations based on a set of records – e.g. finding the average salary across a group of employees. Read more 5 Aug 2021 Ignacio L. Bisso How to Define a Window Frame in SQL Window Functions The window function is a super powerful resource of the SQL language. At the core of any window function, there is a set of records, called the window frame, defined using an OVER clause. Knowing what records are in the window frame, how they are ordered, and what their upper and lower bounds are, are critical in understanding how window functions work. In this article, we will analyze and explain with examples how you can define different types of window frames. Read more «« « 1 2 3 … 6 » »»