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.
In this lesson we are going to talk about the UNION clause. You can use the UNION clause to combine rows from two different queries into one result. Unlike a join, which combines columns from different tables, a union combines rows from different tables. Here is an illustration of what an UNION looks like [click to continue…]
The series starts with the article Introduction to Database Joins. 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. In this article we are going to cover outer joins.
An outer join is used to match rows from two tables. Even if there is no match rows are included. Rows from one of the tables are always included, for the other, when there are no matches, NULL values are included.
Types of Outer Joins
There are three types of outer joins:
- Left Outer Join – All rows from the left table are included, unmatched rows from the right are replaced with NULL values.
- Right Outer Join – All rows from the right table are included, unmatched rows from the left are replaced with NULL values.
- Full Outer Join – All rows from both tables are included, NULL values fill unmatched rows.
Let’s dig a deeper and explore the left outer join. [click to continue…]
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 is an indicator. Don’t think of NULL as similar to zero or blank, it isn’t the same. Zero (0) and blanks “ “, are values.
In most of our beginning lessons we’ve assumed all tables contained data; however, SQL treats missing values differently. It is important to understand how missing values are used and their effect on queries and calculations. [click to continue…]
I recently got to know Dennis through twitter and essentaiSQL.com. If you’re non-technical, you’ll find this interview inspiring. You too can learn SQL. If you’re a techie or IT pro, Dennis provides great comments and insights on SQL and data services; ways to better serve your customers.
Before we begin, I want to remind you all that if you have other questions you want answered, then post a comment or tweet me. I’m here to help you.
With that let’s begin the interview!
[click to continue…]
Recently I had the opportunity to conduct a short interview with Boris Hristov. I think you find this interview interesting as Boris reveals how he became a DBA and ultimately awarded a MVP designation.
Boris recently created a course to teach DBA’s Policy Based Management; click here to see the course (aff link). By Using PBM, you can enforce facets such as naming conventions, configuration settings, or data file locations, for example.
PBM is a really valuable and time saving tool. It’s value comes to light once you realize you’re managing hundreds of databases that developers are getting their hands into!
It provides an automated means to enforce standards across all the DB’s you manage.
Now that you know about one of Boris’ passions, let’s begin the interview.
[click to continue…]