Combine Tables Archives
There are many ways you can combine tables together.
This page is a collection of articles going over set operators, joins, sub queries, and common table expressions.
Use set operators when you wish to combine rows from separate tables together.
Joins come in handy when you want to combine columns from two or more tables.
I love using subqueries to avoid hard coding values in my where clause.
Finally, when you combine tables together, your statements can get real funky and unmanageable. Use Common Table Expressions to make the more readable!
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.