Archive

Category Archives for "How To Use SQL"

This archive contains slew of posts on how to use SQL to solve problem.  If you have a question about a particular issue, or technique, you may find a solution here.

For instance, here is one of our more “fun” article on how to use SQL to create a bar chart:  How to Create A Bar Chart Using SQL Server

If you’re studying for the 70-761 Querying Microsoft SQL Server certification, these two articles are a must read:

All the examples for this lesson are based on Microsoft SQL Server Management Studio and the sample databases AdventureWorks and WideWorldImporters.  You can get started using these free tools using my guide Getting Started Using SQL Server

Learn how to Work Joins and Messy Data

In this puzzle, we’re going to learn how to join dirty data using SQL Server.  Many times you’re forced to use someone else’s data.  Since it is their system and data, not yours, you can’t always fix the inconsistently formatted data before it is in the database. So how can you use it?  Do this […]

Continue reading
4

Write 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 this lesson are based on Microsoft SQL Server Management Studio and the AdventureWorks2012 database.  You can get started using these free tools […]

Continue reading

How 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 how they relate to one another is key.   The series starts with this introductory article. All the examples for this […]

Continue reading
2

How do I combine results from more than one table?

Combine data in SQL

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 […]

Continue reading
8

Use 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 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 […]

Continue reading