본문으로 바로 가기
kitlocal.dev

SQL 치트시트

로컬에서 실행

100% 브라우저에서 처리됩니다. 입력과 출력이 기기 밖으로 나가지 않습니다.

SQL 문법, 조인, 함수, 데이터 타입 빠른 참조.

동작 원리

SQL evaluates logically as FROM/JOIN -> WHERE -> GROUP BY -> HAVING -> SELECT/WINDOW -> DISTINCT -> ORDER BY -> LIMIT, even though `SELECT` is written first.

서바이벌 키트

가장 먼저 배워야 할 몇 가지 명령어입니다.

42개 명령어

키보드 단축키/검색창 포커스JK선택 이동C선택 항목 복사F선택 항목 북마크Esc검색 지우기

Select, Filter & Pagination

Filter predicates safely, avoid NULL traps, sort, and paginate efficiently.

  • 기본

    Filter rows, sort deterministically, and cap returned rows

    SELECT <cols> FROM <table> WHERE <cond> ORDER BY <col> DESC LIMIT <n>;

    명령어 만들기

    SELECT <cols> FROM <table> WHERE <cond> ORDER BY <col> DESC LIMIT <n>;

    값은 입력한 그대로 삽입됩니다. 공백이나 특수 문자가 포함된 경우 직접 따옴표로 감싸 주세요.

    사용 시점

    Adding a tie-breaker column to `ORDER BY` guarantees repeatable pagination order.

    예제

    SELECT id, email, created_at FROM users WHERE status = 'active' ORDER BY created_at DESC, id DESC LIMIT 25;

Joins & Set Operations

Combine related tables cleanly and find orphan or unmatched rows.

Aggregation, CTEs & Window Functions

Group metrics, stage readable queries with CTEs, and rank without collapsing rows.

Insert, Upsert, Update & Delete

Write idempotent mutations safely inside transactions without locking accidents.

Schema, Constraints, JSON & Performance

Design tables, composite indexes, JSON queries, and inspect EXPLAIN plans.

KitLocal 도구에서 사용해 보기

2026. 11. 15.에 확인됨 · ANSI SQL + PostgreSQL 17 / MySQL 8.4 / SQLite 3.45 notes 기준으로 확인됨

출처: PostgreSQL 17 Documentation · SQLite SQL Syntax · MySQL 8.4 Reference Manual

꺾쇠괄호 안의 내용을 본인의 값으로 바꾸세요. 명령어는 공식 문서에서 가져왔으며, 예제는 명시된 버전에서 실행되었습니다.