Reading Time: 7 minutesSQL Server temp tables are very useful tools available to us when it comes to querying and developing SQL Server databases. Temp tables offer a very easy way to create a table for a singular purpose and then remove that table when we are finished with it. In this very brief Continue Reading
Querying data
SQL Server IN Clause: Explained with Examples
Reading Time: 2 minutesThe SQL Server IN clause is a very helpful tool we can use to simplify our queries. In this very brief tutorial, we’ll discuss how the IN clause works and provide examples of it’s use. Take the following Books table: What if we wanted to write a query where we Continue Reading
How to break a WHILE loop in SQL Server: Explained with Examples
Reading Time: 2 minutesThe task of breaking a WHILE loop in Microsoft SQL Server is very simple. We basically break a while loop when we want to terminate the loop early. That is, earlier than the loop would have ended if left to it’s natural progression. To break a WHILE loop early, just Continue Reading
How to find a SQL Server column name: Run this one simple query!
Reading Time: 3 minutesIf you have a particularly large database, finding a specific column might be a bit of a challenge. Maybe you don’t recall exactly what the column name is, and you’re not sure what table it belongs to. Luckily, Microsoft SQL Server has some build in system tables that can help Continue Reading
How To Get a Running Total of Your SQL Data: Explained for Beginners
Reading Time: 5 minutesIn this very brief tutorial, we’ll discuss how to gather a very particular kind of SQL data: A running total. The best way I found to gather a running total (sometimes called a rolling total) of SQL data is to… Use the SUM() aggregate window function There might be other Continue Reading
SQL Server NULLIF: Explained for Beginners
Reading Time: 5 minutesThere are many ways we can compare the equivalency of two values in Microsoft SQL Server. We can use the regular equals ( = ) operator in an IF statement, for example, or we can use the handy CASE statement within the column list of a SELECT statement. But there Continue Reading
Do you know this rule about the CAST function?
Reading Time: 3 minutesThe CAST() system function is one of the most useful tools we have available to us in Microsoft SQL Server. We basically use it to convert a value from one data type to another on-the-fly. I was using CAST() in a query recently and encountered an interesting problem. If you Continue Reading
FULL OUTER JOIN: The Ultimate Guide for Beginners
Reading Time: 8 minutesOne of the most common tools we use when querying SQL Server databases is the JOIN operation. There are many different kinds of JOIN operations in SQL Server, including: INNER JOIN LEFT OUTER JOIN RIGHT OUTER JOIN CROSS JOIN In this very brief tutorial, we’ll discuss a fifth type of Continue Reading
RIGHT JOIN in SQL Server: Explained for Beginners
Reading Time: 7 minutesThe JOIN operation in SQL Server is probably one of the most widely used querying tools available to us in Microsoft SQL Server. It is very important that you how JOINs work and the differences between the different types of JOINs. One type of JOIN is the RIGHT JOIN. In Continue Reading
CROSS JOIN in SQL Server: Explained for Beginners
Reading Time: 4 minutesKnowing how JOIN operations work in SQL Server is extremely important. I would say most of the queries you will ever right in your career as a database professional will involve some kind of JOIN operation. The INNER and LEFT JOINS are the most common, but it’s also important to Continue Reading