This article provides an overview of the self join in SQL, as well as a basic example.
Continue readingTag: create query
SQL Natural Join
This article provides an overview of the natural join in SQL, as well as some basic examples.
Continue readingSQL Full Join
This article provides an overview of the FULL JOIN
in SQL, as well as some basic examples.
SQL Cross Join
This article provides an overview of the CROSS JOIN
in SQL, as well as some basic examples.
SQL Left Join
This article provides an overview of the LEFT JOIN
in SQL, as well as some basic examples.
SQL Inner Join
This article provides an overview of the INNER JOIN
in SQL, as well as some basic examples.
SQL Right Join
This article provides an overview of the RIGHT JOIN
in SQL, as well as some basic examples.
SQL Alias Explained
The SQL alias is a nice little feature of SQL that allows you to write more concise code and create column names when no column name exists.
There are two SQL alias types; column aliases, and table aliases. In this article, I provide an overview of both.
Continue readingHow to Write an ORDER BY Clause with Exceptions using SQL
In SQL, the ORDER BY
clause is commonly used to order the results of a query. It allows you to select one or more columns to order the results, and in most cases, it’s probably all you need.
But what if you need to make an exception?
What if you want the results to be ordered alphabetically, except for one row? Or several rows?
Or perhaps you simply want to put any NULL values to the end, while ordering the non-NULL results.
Either way, there’s a neat trick you can use that will enable you to do this. And the good part is, it’s simple.
You can cater for all of the above scenarios by adding a CASE
expression to your ORDER BY
clause.
How to Fix “Only one expression can be specified in the select list…” in SQL Server
In SQL Server, error message 116 occurs when you try to select multiple columns in a subquery without introducing it with the EXISTS
operator.