How to use the EXCEPT operator
How to use the Except Operator The EXCEPT operator is used to exclude like rows that are found in one query but not another. It returns rows that are unique to one result. To use the EXCEPT operator,...
View ArticleUse SQL Server to Sort Alphanumeric Values
Sort Alphanumeric Values with SQL Server Recently a reader asked me how to sort an alpha numeric field in SQL in natural order. Alphanumeric values are commonly found and don’t sort naturally using...
View ArticleHow do I combine results from several SQL tables (hint: there are three ways)
Many times in a relational database the information you want to show in your query is in more than one table. This begs the question “How do you combine results from more than one table?” All the...
View ArticleWhat is the Difference between ORDER and GROUP BY?
The GROUP and ORDER BY clauses are both used to organize data. Learn which is used to sort the data, and which is used for counting and summing. All the examples for this lesson are based on Microsoft...
View ArticleWhat is the difference between WHERE and HAVING clauses?
In this article learn when to use WHERE and HAVING. Both perform similar functions, but for different purposes! All the examples for this article are based on Microsoft SQL Server Management Studio...
View ArticleSQL Truncate and Delete
In SQL Server there are a couple a ways you can delete rows from a table. You can use the TRUNCATE and DELETE command. Though the end result of both commands is the same, there are very important...
View ArticleLearn about Stored Procedures
What is a Stored Procedure? A stored procedure is a group of one or more database statements stored in the database’s data dictionary and called from either a remote program, another stored procedure,...
View ArticleSubqueries – Introduction to a Subquery in SQL
The purpose of this article is to introduce you to subqueries and some of their high-level concepts. There are a lot of details to cover in order to learn sub queries, but you’ll see we cover those...
View ArticleUsing Subqueries in the Select Statement (with examples)
This is the second in a series of articles about subqueries. In this article we discuss subqueries in the SELECT statement’s column list. Other articles discuss their uses in other clauses. All the...
View ArticleWhat is a Database Trigger?
What is a Database Trigger? A database trigger is special stored procedure that is run when specific actions occur within a database. Most triggers are defined to run when changes are made to a...
View ArticleUsing Subqueries in the WHERE Clause
This is the third in a series of articles about subqueries. In this article we discuss subqueries in the WHERE clause. Other articles discuss their uses in other clauses. All the examples for this...
View ArticleQuery Plans in SQL
All the examples for this lesson are based on Microsoft SQL Server Management Studio and the AdventureWorks2012 database. You can get started using these free tools using my Guide Getting Started...
View ArticleUsing A Subquery in the FROM clause
This is the fourth in a series of articles about subqueries. In this article we discuss using a subquery in the FROM clause. Other articles discuss their uses in other clauses. All the examples for...
View ArticleGet Ready to Learn SQL Server 23: Using Subqueries in the HAVING Clause
This is the fifth in a series of articles about subqueries. In this article we discuss subqueries in the HAVING clause. Other articles discuss their uses in other clauses. All the examples for this...
View ArticleSQL Skills are Valuable, Learn why!
Are you serious about learning SQL? If so, then get started with free tools using my Guide Getting Started Using SQL Server. Is SQL a Valuable Skill… is it Sought Out? If I was to say that SQL is not...
View ArticleWhat is a SQL Server Data Dictionary?
What is a Data Dictionary? In SQL Server the data dictionary is a set of database tables used to store information about a database’s definition. The dictionary contains information about database...
View ArticleLearn the Three Crucial Steps to Writing Better SQL
You can learn to write SQL. It isn’t hard. Yes, there are many details to mind, but none of it is impossible. In this series of articles I’ll show you the three steps I go through to write complex...
View ArticleHow to Write SQL – Understand Database Table Meanings and Relationships – Step 1
The first step to write SQL is to understand the database tables meanings and relationships. This is important, as complex queries often span more than one table. Knowing the purpose of the table and...
View ArticleWrite SQL – Formulate your Question – Step 2
To write SQL it is important to understand the question you wish to ask the database. I know this seems pretty obvious, but you would be surprised how many people get tripped up on this step. Some...
View ArticleWrite Better SQL – Step 3 of 3
To write sql, we’ll take all the information we’ve compiled in the previous articles and map it to the appropriate SELECT clause. The series starts with this introductory article. All the examples for...
View Article