Getting Started

Hello, my name is Kris Wenzel and welcome to Essential SQL.  There is so much to absorb when learning SQL. My job is to steer you in the right direction and get you started on the right foot.

It can get pretty overwhelming learning SQL.  To help, I’ve created the following SQL Server resources and online tutorials to get you started.  They start from ground zero, and assume you no nothing of SQL.

If you're new to SQL let's get started with these three steps:

  1. 1
    Join my free email course "Get Started Learning SQL Server."
  2. 2
    Get engaged with my SQL community on Face Book, join it today.
  3. 3
    New!  Check out my online SQL server tutorial.

Oh!  I almost forgot.  I have ton's of free video for you to watch.  Be sure to subscribe to my YouTube channel to keep up-to-date.

 Beginning SQL Server Introductory Articles

  • Simple Select Queries – To query your data you’ll use the select command.  This lesson covers basic concepts.

Database Normalization

Database Normalization – Understand why it is important to organize data into separate tables.  Knowing this, makes learning Joins so much easier.

Database Joins, Subqueries, and Sets

Common Table Expressions

Introduction to CTEs (Common Table Expressions)— CTE’s are used to simplify complex joins and subqueries, and to provide a means to query hierarchical data.

Introduction to Insert, Update, and Delete

Common Questions

Along the way you’re bound to have questions about databases in general, the pieces that make them up, or something unusual about SQL.  Check out these questions to satiate your curiosity

Can I have a CASE Statement in the WHERE Clause?

A very common question I get asked is whether I can have a CASE Statement in the WHERE Clause. There are a number of examples of CASE being used in SELECT columns, or in ORDER

Read More

I recently put together a lesson on why we need SQL stored procedures.  It is part of my Stored Procedures Unpacked course.  SQL Stored procedures are a great way to encapsulate logic securely, while allowing client program an easy way to execute it. The good news is that writing SQL stored procedures isn’t as hard

​Read More

As the word “Restore” suggests, this Microsoft SQL server error 3154 is associated with SQL Backup.  Even though SQL Administrators have vast experience in setting and regulating of SQL database and its backup, they get stuck when they experience SQL database error 3154 because this error is displayed when users try to restore SQL database (DB)

​Read More

A reader recently asked about a error converting data type error they received.  Since this is a common issue, especially when numeric data is stored withing VARCHAR datatypes, I thought you would appreciate the answer I shared with them. I’m using Windows 10 and SQL SMS 2014.  When I run a query, I get the

​Read More

In this video we’ll walk you through how to include a single quote in a SQL query; we’ll show how to escape the single quote, so it is treated as text rather than text delimiters. Once you’ve gone through this article, I would recommend watching our next Essential SQL Minute continue to learn more about

​Read More

In this article we learn the difference between a primary and unique key, and why both are important to maintaining a relational database structure. 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 Using SQL

​Read More

When modifying one table based on the contents of another it may be tempting to simply use the merge statement, but before you throw away all other forms of modifying data, I think it’s important for you to know the difference between merge and update. What is the Difference Between MERGE and UPDATE? Both the

​Read More

In this article, we will be exploring the CAST and CONVERT functions to understand whether there are any significant differences worth knowing when we want to data from one type to another. Since the CAST and CONVERT can be used interchangeably in most situations, you may wonder if one function is better than the other.

​Read More

Both inner and outer joins can be used to combine data from two or more tables; however, there are some key differences!  Read this article to find out each command’s strengths and when to use them. To get the most of this and our other lessons, be sure to practice using the examples! All the

​Read More

Both Joins and UNIONS can be used to combine data from two or more tables.  Read this article to find out each command’s strengths and when to use them. To get the most of this and our other lessons are sure to practice using the examples! All the examples for this lesson are based on

​Read More

Joins and subqueries are both be used to query data from different tables and may even share the same query plan, but there are many differences between them.  Knowing the differences and when to use either a join or subquery to search data from one or more tables is key to mastering SQL. All the examples

​Read More

Both TOP and OFFSET & FETCH can be used to limit the number of rows returned.  OFFSET and FETCH can return similar results to top, but there are differences which may influence which method is best for you to use in your given situation. All the examples for this lesson are based on Microsoft SQL

​Read More

This article will teach you the difference between a primary key and a foreign key. This article will also teach you why both of these keys are important when it comes to the maintenance of a relational database structure. All the examples for this lesson are based on Microsoft SQL Server Management Studio and the

​Read More

This article is inspired by a series of questions that one of my readers, Nan, recently sent me regarding DISTINCT, TOP, and ORDER BY. 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 Using

​Read More

A reader recently asked me to help them solve a problem combining data from multiple tables into a single result.  What was interesting was that the solution used the three ways to combine data that we have recently covered, namely:  JOINS, set operators, and subqueries. Given the comprehensive nature of this problem I thought it

​Read More

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 objects such as tables, indexes, columns, datatypes, and views. The data dictionary is used by SQL Server to execute queries and is automatically updated

​Read More

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 a sought out skill would you believe me?   Is it possible to safely say that since databases

​Read More

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 Using SQL Server.  Let’s get started and learn about a query plan. What is a Query Plan? A query plan is a set of steps that

​Read More

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 table’s data.  Triggers can be defined to run instead of or after DML (Data Manipulation Language) actions such as INSERT, UPDATE,

​Read More

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, or the command line.  Stored procedure are commonly called SPROCS, or SP’s.  Stored procedure features and command syntax are specific to the

​Read More

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 differences you should know about. Whats the Difference between Truncate and Delete? The TRUNCATE command is like a DELETE

​Read More

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 and the AdventureWorks2012 database.  You can get started using these free tools using my Guide Getting Started Using SQL Server. How do Where and Having Differ?

​Read More

Both the GROUP and ORDER BY clauses are used in organizing data. Find out which of the two is used to sort the data and which is used for counting and summing up. All the examples for this lesson are based on Microsoft SQL Server Management Studio and the AdventureWorks2012 database.  You can get started

​Read More

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 examples for this lesson are based on Microsoft SQL Server Management Studio and the AdventureWorks2012 database.  You can

​Read More

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 numeric methods. When we have a numeric fields we expect values to be sorted in ordinal order, for example: 1,2,5,7,10,11,15,20,21 However when

​Read More

What is a Null Value? In databases a common issue is what value or placeholder do you use to represent a missing values.   In SQL, this is solved with null.  It is used to signify missing or unknown values.  The keyword NULL is used to indicate these values.  NULL really isn’t a specific value as much as it

​Read More

A database view is a searchable object in a database that is defined by a query.  Though a view doesn’t store data, some refer to a views as “virtual tables,” you can query a view like you can a table.  A view can combine data from two or more table, using joins, and also just

​Read More

There is more to being a Junior DBA than knowing SQL.  The DBA works at the intersection of the database, server, operations group, and developers.  A DBA must understand concepts from all these facets of IT as well as be able to draw upon knowledge of their production environment to troubleshoot performance, hardware, and software

​Read More

Everyone has their favorite DBMS, is your favorite one of the top databases? Though some non-relational products have entered the top ten, the relational paradigm remains firmly entrenched in the database world.  However specialized database types such document store databases and wide column stores are gaining in popularity to become top databases. Top of the

​Read More

A database index allows a query to efficiently retrieve data from a database.  Indexes are related to specific tables and consist of one or more keys.  A table can have more than one index built from it.  The keys are a fancy term for the values we want to look up in the index.  The

​Read More

A relational database is made up of several components, of which the table is most significant.  The database table is where all the data in a database is stored, and without tables, there would not be much use for relational databases.   Overall Structure of a Database Table A database consists of one or more

​Read More

The main objective of a database management system is to store, retrieve, and process data.  In order to do this in a safe and efficient manner, several major components work together to achieve this aim.  They are: Databases Security Data Dictionary Storage Engine Query Processor

...
​Read More

A SQL database is used to store and retrieve data.  The database is housed in a database server and largely controlled by a database management system.  All SQL databases, whether they MS SQL Server, MySQL, Oracle, or Progress have several components in common.  They are: Tables Indexes Views Stored Procedures Triggers It is these various

​Read More

What are the  ACID Database Properties? The ACID database properties define SQL database key properties to ensure consistent, safe and robust database modification when saved. ACID is an acronym that helps to remember the fundamental principles of a transnational system. ACID stands for Atomic, Consistent, Isolation, and Durability.  Here are some informal definitions: Atomic – In a transaction

​Read More
>