27 Sep 2018 Ignacio L. Bisso How to Begin Running SQL Queries In this article, I’ll explain how to run a SQL query to help you execute your first one. Let’s jump right in! Running SQL queries for the first time is not a complex task, but it can seem intimidating at first if you’re a complete beginner. But once you get past that initial roadblock, you’ll be able to focus on learning SQL and writing more interesting queries to meet your business needs. Read more 8 Jun 2018 Ignacio L. Bisso Improving Slow Query Performance: When Runtime Matters As SQL users, we usually focus on writing queries that return correct results. However, there are more things to consider when you're writing a query; one of them is query performance. In this article, we'll look at some examples where query response time is critical. Scene One: 911 Call Center Let's suppose we're at a 911 call center, when the phone rings. One of the operators answers the call; a witness reports that a man has been shot. Read more 8 May 2018 Ignacio L. Bisso Converting Subqueries to Joins Not all queries are alike, especially in terms of performance. In this article, we'll look at how you can convert SQL subqueries to joins for improved efficiency. When Should I Use SQL Subqueries? Great question! Unfortunately, there's no concrete answer. SQL beginners tend to overuse subqueries. Typically, once they find that SQL construction works in one situation, they try to apply that same approach to other situations. It's only natural. Read more 10 Apr 2018 Ignacio L. Bisso Learn to Write a SQL Correlated Subquery in 5 Minutes If you’re familiar with the famous Russian nesting doll, then SQL correlated subqueries should be a peace of cake to understand—subqueries are just queries nested within queries. An SQL subquery is often called an “inner” query; the main query is usually called the “outer” query. This article covers everything you need to know about correlated subqueries. What Exactly is a SQL Correlated Subquery? A correlated SQL subquery is just a subquery that is executed many times—once for each record (row) returned by the outer (main) query. Read more 29 Mar 2018 Ignacio L. Bisso Extracting Data From a String: SPLIT_PART in PostgreSQL Learn how to use split_part in PostgreSQL to extract data from strings. Quite often, we’d like to extract parts of a string when working with text values. A common example is when we have a full name and need to retrieve only the last name. In this article, we’ll examine how to do it using split_part in PostgreSQL, i.e. a string-related function that can be used to extract a substring. Read more 9 Feb 2018 Ignacio L. Bisso How to Remove Junk Characters in SQL Unwanted characters in text data can be a bit of a pain, but there’s an easy way to fix them. Scroll down to learn how to remove junk characters in SQL in the easiest way! Sometimes, we’ll find unwanted characters inside our string data because our SQL queries didn’t work as expected. Moreover, these extra characters may sometimes be invisible, which really complicates things. In this article, we’ll examine some string-related SQL functions that can handle unwanted characters—visible or not! Read more 31 Jan 2018 Ignacio L. Bisso How to Solve Capitalization Data Quality Issues Misspelled names, typos, and text data quality issues in your database? Power up your queries! Use SQL string functions to address data quality issues related to capitalization. Sometimes, our SQL queries don't work as expected because of data quality issues. In this article, we will examine some string-related SQL functions that can correct data quality issues related to capitalization. We'll be using PostgreSQL in our examples, but similar functions are available in most database engines. Read more 7 Dec 2017 Ignacio L. Bisso The SQL Coalesce Function: Handling Null Values You may already know how to return null values in SQL. Now, we’re going to learn how to do the opposite. Though the SQL COALESCE function may seem complex, it’s actually very straightforward and useful. Let’s look at several examples of how the SQL COALESCE function can be used to work with NULL values in SQL. The Need for Coalesce in SQL Before we dive into the SQL COALESCE function in detail, you should understand how NULL values behave in expressions. Read more 27 Nov 2017 Ignacio L. Bisso SQL Date and Interval Arithmetic: Employee Lateness Computing Tardiness: Date, Time, and Interval SQL Arithmetic In this article, we’re going to discuss some interesting operations we can perform with date-related data types in SQL. The SQL standard, which most relational databases comply with these days, specifies the date-related data types that must be present in relational databases. The most important of such data types are date, time, timestamp, and interval. Here’s a brief rundown of the differences between these data types: Read more 18 Oct 2017 Ignacio L. Bisso Learn SQL Views in 30 Minutes Views aren't complicated – if you've got half an hour, we'll get you started writing SQL queries using views! Let's start by answering the question "What is a view in SQL?'. A view is a database object (as is a table, an index, or a stored procedure). Like a table, you can query a view and extract the information in it. It can be used in the FROM clause of a SELECT, and you can reference view columns in clauses like SELECT, WHERE and GROUP BY among other clauses as well. Read more «« « 1 2 3 4 5 6 » »»