가장 많이 묻는 면접 질문과 답변 & 온라인 테스트
면접 준비, 온라인 테스트, 튜토리얼, 라이브 연습을 위한 학습 플랫폼

집중 학습 경로, 모의고사, 면접 준비 콘텐츠로 실력을 키우세요.

WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.

Chapter 6

Joins, Relationships, Constraints, Normalization, and Data Modeling

Learn how SQL Server tables relate to each other and how good relational design reduces duplication and inconsistency.

Inside this chapter

  1. Why Relationships Matter
  2. Primary Keys and Foreign Keys
  3. Joining Tables for Useful Results
  4. Normalization and Tradeoffs

Series navigation

Study the chapters in sequence for the smoothest path from SQL Server basics to advanced T-SQL, performance, and production operations. Use the navigation at the bottom of each page to move through the full tutorial series.

Tutorial Home

Chapter 6

Why Relationships Matter

Relational databases become powerful when tables can describe meaningful relationships. Customers place orders. Orders contain order items. Employees belong to departments. Students register for courses. Instead of copying the same text into many rows, SQL Server lets you store data once and connect it through keys.

Chapter 6

Primary Keys and Foreign Keys

CREATE TABLE dbo.OrderItems (
    OrderItemId BIGINT IDENTITY(1,1) PRIMARY KEY,
    OrderId BIGINT NOT NULL,
    ProductId BIGINT NOT NULL,
    Quantity INT NOT NULL,
    UnitPrice DECIMAL(10,2) NOT NULL,
    CONSTRAINT FK_OrderItems_Orders
        FOREIGN KEY (OrderId) REFERENCES dbo.Orders(OrderId),
    CONSTRAINT FK_OrderItems_Products
        FOREIGN KEY (ProductId) REFERENCES dbo.Products(ProductId)
);

Foreign keys enforce referential integrity so related records cannot silently break.

Chapter 6

Joining Tables for Useful Results

SELECT
    o.OrderId,
    c.FullName,
    o.OrderStatus,
    o.OrderDate
FROM dbo.Orders o
JOIN dbo.Customers c ON c.CustomerId = o.CustomerId
WHERE o.OrderStatus = 'PENDING';

Joins are used constantly in reports, admin tools, analytics, and application services. Deep join understanding is one of the clearest signs that a student has moved beyond basic SQL.

Chapter 6

Normalization and Tradeoffs

Normalization helps keep data consistent by reducing unnecessary duplication. Customer contact details belong in the customer table, not copied into each order row. At the same time, some duplication can be intentional, such as storing item price in an order line to preserve historical billing accuracy. Advanced design means understanding those tradeoffs rather than blindly following rules.

Copyright © 2026, WithoutBook.