Ir al contenido principal
kitlocal.dev

Chuleta de SQL

Ejecución local

Procesado al 100 % en tu navegador. Las entradas y salidas nunca salen de tu dispositivo.

Referencia rápida de sintaxis SQL, joins, funciones y tipos de datos.

Cómo funciona

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

Kit de supervivencia

Los comandos clave que conviene aprender primero.

42 comandos

Atajos de teclado/Enfocar búsquedaJKMover selecciónCCopiar seleccionadoFMarcar seleccionadoEscBorrar búsqueda

Select, Filter & Pagination

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

  • Esencial

    Filter rows, sort deterministically, and cap returned rows

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

    Construye el comando

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

    Los valores se insertan exactamente como los escribes. Ponlos entre comillas si contienen espacios o caracteres especiales.

    Cuándo usarlo

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

    Ejemplo

    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.

Pruébalo en una herramienta de KitLocal

Comprobado el 15 nov 2026 · Comprobado con ANSI SQL + PostgreSQL 17 / MySQL 8.4 / SQLite 3.45 notes

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

Sustituye todo lo que esté entre corchetes angulares por tus propios valores. Los comandos proceden de la documentación oficial y los ejemplos se ejecutaron en la versión indicada.