Lesson 24/100

Tutorials SQL Server Tutorial

FULL OUTER JOIN — Complete Guide

FULL OUTER JOIN — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of SQL Server Tutorial on Toolliyo Academy.

On this page

SQL Server Tutorial · Lesson 24 of 100

FULL OUTER JOIN

SQL basicsQueriesAdvanced

SQL basics · 1 — SELECT · ~6 min · SQL — Joins & Relationships

What is this?

FULL OUTER JOIN returns rows when either side matches. Unmatched left or right rows appear with NULLs on the other side.

Why should you care?

Data reconciliation — compare two lists (source vs target) and see extras on either side in one pass.

See it live — copy this example

Run in SQL Server Management Studio (SSMS) or Azure Data Studio.

USE DataVerse;
IF OBJECT_ID(N'dbo.PosSales', N'U') IS NOT NULL DROP TABLE dbo.PosSales;
IF OBJECT_ID(N'dbo.OnlineSales', N'U') IS NOT NULL DROP TABLE dbo.OnlineSales;
CREATE TABLE dbo.PosSales (Sku VARCHAR(32) PRIMARY KEY, Qty INT);
CREATE TABLE dbo.OnlineSales (Sku VARCHAR(32) PRIMARY KEY, Qty INT);
INSERT INTO dbo.PosSales VALUES ('A', 5), ('B', 2);
INSERT INTO dbo.OnlineSales VALUES ('B', 3), ('C', 4);
SELECT
    COALESCE(p.Sku, o.Sku) AS Sku,
    p.Qty AS PosQty,
    o.Qty AS OnlineQty
FROM dbo.PosSales AS p
FULL OUTER JOIN dbo.OnlineSales AS o ON o.Sku = p.Sku;

What happened?

  • Sku A is POS-only, C is online-only, B is both.
  • FULL OUTER JOIN surfaces all three cases for a stock sync review.

Practice next

  1. Create the two sales tables and run the join.
  2. Identify rows where PosQty IS NULL or OnlineQty IS NULL.
  3. Add a computed difference column ISNULL(o.Qty,0) - ISNULL(p.Qty,0).
  4. Filter WHERE p.Sku IS NULL OR o.Sku IS NULL for mismatches only.
  5. Add a third channel table later with a different pattern.

Remember

FULL OUTER keeps unmatched rows from both sides. Great for reconcile / diff reports. COALESCE the business key in the SELECT list.

POS vs online qty reconcile

Nightly job diffs DataVerse POS and online quantities.

Outcome: Ops investigates SKUs present in only one channel.

Interview prep for this lesson

Practice these questions aloud after reading—each links to a full structured answer.

Mid PDF Detailed
FULL OUTER JOIN: Returns all rows from both tables, with matching rows where?
Short answer: available. If there’s no match, NULL is returned for the missing side. Use case: When you want all records from both tables. Say this in the interview Define — one clear sentence (the short answer above). E…
Mid PDF Detailed
Faster Search: Indexes allow the database to locate rows much faster than a full?
Short answer: Faster Search: Indexes allow the database to locate rows much faster than a full? is a common interview topic in SQL & Databases. Give a clear definition, then one concrete example. Real-world example (…
Mid PDF Detailed
Full Backup:?
Short answer: A full backup includes all the data in the database at the time the backup is taken. It is a complete snapshot of the database. Advantages: Easy to restore; ensures a full copy of the database. Disadvantage…
Mid PDF Detailed
INNER JOIN: Returns only the rows with matching values in both tables.?
Short answer: Use case: When you only want matching records. Say this in the interview Define — one clear sentence (the short answer above). Example — relate it to a project like ShopNest or your real work. Trade-off — w…
Mid PDF Detailed
Move to 2NF: Ensure that all non-key attributes are fully functionally dependent?
Short answer: on the primary key. Remove partial dependencies (when a non-key attribute depends on part of a composite key). Real-world example (ShopNest) Product and Category are separate tables (normalized). The order…
Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

SQL Server Tutorial
Course syllabus

SQL Server Tutorial

SQL — Foundations
SQL — SQL Queries & Clauses
SQL — Joins & Relationships
SQL — Indexing & Performance
SQL — Stored Procedures & Functions
SQL — Transactions & Concurrency
SQL — Advanced SQL Server
SQL — Security & High Availability
SQL — 2022 & Cloud
SQL — Real-World Projects
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details