SELECT * FROM users;Convenient interactively, but explicit column lists are often better for apps and stable contracts.
High-value SELECT, INSERT, UPDATE, DELETE, UPSERT, ORDER BY, LIMIT, and filtering patterns for day-to-day SQLite development.
Select, sort, paginate, and project rows efficiently.
SELECT * FROM users;Convenient interactively, but explicit column lists are often better for apps and stable contracts.
SELECT id, email, created_at FROM users;Fetching only the columns you need reduces transfer and simplifies downstream code.
SELECT id, title FROM posts WHERE title LIKE '%sqlite%';LIKE is convenient for simple matching; full-text search is better for larger text search needs.
SELECT id, email, created_at FROM users ORDER BY created_at DESC LIMIT 20;A core pattern for dashboards, logs, and feed-style pages.
SELECT id, email FROM users ORDER BY id LIMIT 20 OFFSET 40;Works well for smaller datasets, though keyset pagination scales better for very large tables.
Core write patterns including conflict handling.
INSERT INTO users (email, display_name) VALUES ('ava@example.com', 'Ava');Explicit column lists make inserts safer as schemas evolve.
INSERT INTO tags (name) VALUES ('sql'), ('sqlite'), ('database');Batch inserts are concise and usually faster than one statement per row.
UPDATE users SET timezone = 'America/Los_Angeles' WHERE id = 1;Always verify the WHERE clause when running updates interactively.
DELETE FROM sessions WHERE expires_at < CURRENT_TIMESTAMP;A common cleanup pattern for caches, sessions, and temporary records.
INSERT INTO users (email, display_name)
VALUES ('ava@example.com', 'Ava Martin')
ON CONFLICT(email) DO UPDATE SET display_name = excluded.display_name;A high-value pattern for sync jobs, imports, and idempotent writes.
INSERT INTO tags (name) VALUES ('sqlite') ON CONFLICT(name) DO NOTHING;Useful for de-duplicated lookup tables and seeding scripts.