This tutorial was originally published on biglandnetwork.com . It is part of the free SQL Server for Beginners series, with a 10-minute video for every lesson.
Real databases keep data in many tables, so almost every useful query needs a JOIN . This guide explains every join type in SQL Server with the same small Employees, Departments and Projects tables, shows the exact result of each query, and finishes with the mistakes that cause wrong or huge results.
Part of the SQL Server for Beginners series. This article is the written version of lesson 2 of the Bigland Network video course, with the same sample data. The results shown were worked out by hand from that data, so run every example on a test database, not on production data.
1. Why data is split into tables
One big table that repeats the department name on every employee wastes space and invites mistakes: rename a department and you must change many rows. Databases instead keep each kind of thing in its own table and connect them with keys .…