Skip to main content

SQLite query builder

Form-driven SQL generator for SQLite. Build SELECT / JOIN / GROUP BY queries, CREATE TABLE and INDEX statements, INSERT / UPDATE / UPSERT mutations, plus PRAGMA introspection and EXPLAIN QUERY PLAN wrappers. Quoting handled automatically. Browser-only — no database access required.

⚠ Disclaimer This tool is provided as-is, for educational and planning purposes only. Generated SQL is a starting point — always review for correctness, use parameterised statements in application code, and back up your database before running mutations (UPDATE / DELETE / UPSERT). The Tech Space makes no warranty and accepts no liability. Full disclaimer →

Filtered SELECT

Read rows from a table with WHERE filters, ORDER BY, and LIMIT.

Category: SELECT Output: Single statement

Inputs

Generated SQL

SQLite

              

Notes & tips

SQLite quick reference

Type affinities (not strict types)

  • INTEGER — 1, 2, 4, 6, or 8 byte signed integer
  • REAL — 8-byte IEEE floating point
  • TEXT — UTF-8, UTF-16BE, UTF-16LE
  • BLOB — raw bytes
  • NUMERIC — integer when possible, real otherwise
Important Type affinity ≠ strict typing. INTEGER columns will happily accept text unless you use STRICT tables (3.37+). Add STRICT after the closing paren of CREATE TABLE for actual type enforcement.

Date storage formats

  • TEXT — ISO 8601: '2026-05-18 14:30:00'
  • INTEGER — Unix epoch seconds: 1747577400
  • REAL — Julian day numbers: 2460849.10417

Common date functions

  • date('now') — today, ISO date
  • datetime('now', 'localtime') — now, local TZ
  • strftime('%Y-%m', col) — format date column
  • unixepoch(col) — convert ISO/Julian to epoch (3.38+)
  • datetime(epoch_col, 'unixepoch') — convert epoch to ISO

JSON1 functions (built-in 3.38+)

  • json_extract(col, '$.path') — extract value at path
  • col ->> '$.path' — shorthand (returns SQL type)
  • col -> '$.path' — shorthand (returns JSON type)
  • json_array_length(col, '$.list') — count array items
  • json_each(col) — explode into rows (table-valued)

PRAGMAs worth knowing

  • PRAGMA foreign_keys = ON; — required per connection, default OFF
  • PRAGMA journal_mode = WAL; — better concurrent read/write
  • PRAGMA table_info(t); — describe a table's columns
  • PRAGMA foreign_key_list(t); — list FK constraints
  • PRAGMA index_list(t); — list indexes on a table
  • PRAGMA integrity_check; — scan for corruption

Gotchas to remember

  • Foreign keys are OFF by default — run PRAGMA foreign_keys = ON; at the start of every connection
  • ALTER TABLE is limited — you can rename/add/drop columns but not change types. For complex changes, copy to a new table
  • Identifiers are case-insensitive but the convention is snake_case
  • String literals use single quotes: 'value'. Double quotes are interpreted as identifiers if a matching column exists, else as strings (legacy behaviour, error-prone)
  • NULL ordering: ORDER BY col puts NULLs first; use ORDER BY col NULLS LAST if you want them at the end
  • INTEGER PRIMARY KEY aliases ROWID — gets auto-assigned; WITHOUT ROWID tables behave differently