Archive

Category Archives for "Common Questions"

Here is a list of common questions I’ve been asked by my students in class or via email.

Whether you’re looking to find out the difference between of primary an foreign key or want to know what is a data dictionary, you’ll find answers to many common problems.

 

If you have a question that I haven’t answered, please ask!  You can contact me here.  I’m always looking to see what you guys need helps with, as it helps me learn!  I love helping!

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

What is the difference between a primary and unique key?

Primary and Unique Key

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

Continue reading

What is the Difference Between Merge and Update?

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

Continue reading

Know when to use Cast versus Convert

In this article we’re going to explore the CAST and CONVERT functions to understand whether there are any significant differences worth knowing when we want to convert data from one type to another. Since CAST and CONVERT can be used interchangeably in most situations, you may be wondering if one is better than the other. […]

Continue reading

What is the Difference between Inner and Outer Joins?

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

Continue reading
5

What is the Difference between a Primary Key and a Foreign Key?

Primary and Foreign Keys

In this article we learn the difference between a primary key and a foreign 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 […]

Continue reading
2

How do the SQL DISTINCT and TOP SELECT Clauses Work Together to Generate Results?

Distinct pattern of terminals

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

Continue reading
2

Is it possible to use Joins, Subqueries, and Unions in one Query?

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

Continue reading

What is a SQL Server Data Dictionary?

Data Dictionary - Cards

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

Continue reading

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

Continue reading
2

What is the Difference between ORDER and GROUP BY?

Differences in Order By versus 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 SQL Server Management Studio and the AdventureWorks2012 database.  You can get started using these free tools using […]

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

What is a Database NULL Value?

Null and unknown values

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

Continue reading
4

What are the Major Part of a SQL DB?

Parts of a Database

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

Continue reading
2

What is ACID (atomicity, consistency, isolation, and durability)?

What are the  ACID Database Properties? The ACID database properties define the key characteristics SQL databases use to ensure database modification are saved in a consistent, safe, and robust manner. ACID is an acronym to remember the key principles of a transnational system.  ACID stands for Atomic, Consistent, Isolation, and Durability.  Here are some informal definitions: […]

Continue reading