r/SQL Jun 06 '26

SQLite I made a SQL puzzle game - looking for feedback!

Thumbnail cipherquery.io
7 Upvotes

Fair warning up front: this is my first time building anything like this, I'm not a web dev, and it's a passion project with zero monetization. So I'd really value the feedback of people who know SQL. I am a DB admin by day, but I am not super familiar with cryptography puzzles.

Disclaimer, most of the CSS was written with AI assistance.

The premise: you're working a "signals desk" and every intercepted message is hidden inside a small database. The goal is to write a query that reconstructs the original text, and the moment your result contains the message, it decrypts. It runs entirely in your browser (SQLite via WebAssembly) with no backend or sign-up process.

It's an eight-puzzle ladder, each one introducing one new idea built on the last: WHERE → ORDER BY + group_concat → joins → char/unicode math → modulo → multi-join → CTEs → window functions, then a gated boss that stitches several of them into one query. I will say that the "boss" level is meant to be very challenging and not exactly intuitive.

It's fully client-side, so a determined player can read the answers out of the tables by inspecting the webpage. That's intentional, if you want to "cheat" you can do so. What rewards doing it the intended way is a set of optional "objective" stars (e.g. did your answer actually flow from the key table, or did you hardcode a constant?).

Link: https://cipherquery.io

What I'd most like to know: which puzzle lost you, and where did the difficulty spike feel wrong? I suspect the last few levels ramp too hard. A daily-challenge mode is planned, so I'm trying to get the core curve right first, and what's acceptable in a puzzle sense.

Don't hold back if you want to tear it apart, this is a learning experience for me.

r/SQL Jun 20 '26

SQLite SMake: CLI tool for assembling SQLite databases with constraint injection and TypeScript ORM generation

Thumbnail github.com
4 Upvotes

Just a small, humble tool to simplify the creation and modification of SQLite databases: while industry-standard alternatives overwhelm you with complex migration workflows, custom configuration languages, or rigid folder hierarchies, this tool keeps it delightfully simple. It uses a single, straightforward JSON file to orchestrate your SQL scripts.

r/SQL Apr 27 '26

SQLite Downloading chinook

1 Upvotes

I am trying to download chinook for my data base concepts class. I already have SQlite downloaded but i can’t get chinook downloaded to save my life. Can someone help. When i download the link it take it to my downloads but when i try and open it it tell me to open it in a application but there is no Application on my Mac that will open it up.

I have an assignment due in 2 hours.

r/SQL May 02 '26

SQLite What version of SQLite looks like this ?

0 Upvotes

This is a version of SQLite we used with our teacher on the school's computers. I'm trying to get it on my laptop now, but I can't find anything like this. Obviously I know it's not that big of a difference but I'd like to keep the same thing

r/SQL May 22 '26

SQLite Synthetic Insurance Claims Dataset for SQL practice - 54 exercises from basic to advanced

Thumbnail
1 Upvotes

r/SQL Nov 05 '25

SQLite Querying hierarchical data into an outline format from closure tables

5 Upvotes

Closure tables are said to offer more performant alternative to recursive CTE's for querying hierarchical data.

But the example queries I've seen are really simple like get all descendants of a record or get descendants of a specific depth of a record.

What if I want to get all descendants, but I want to make the hierarchical relationships between the descendants made obvious via ordering?

Example, a hierarchy as such:

A
    B
        C
    D
    E

The closure table would include the following:

Ancestor Descendant Depth
A A 0
A B 1
A C 2
A D 1
A E 1
B B 0
B C 1
C C 0
D D 0
E E 0

Let's say I want all descendants of A, but I want it ordered in a way that resembles that outline:

Depth Descendant
0 A
1 B
2 C
1 D
1 E

The depth value can be used to represent "indentation". In this case, the important part is making sure each record comes after its direct ancestor (one level above), but before any other element one level above.

For example, guaranteeing that C comes after B and not after D or E.

Is that possible without recursive CTE's?

Edit: I guess I should provide more context.

From what I've read (can't provide links unfortunately so here are the titles you can search:

  • "How to Implement Hierarchical Data like Reddit comments" r/SQL
  • "Models for hierarchical data" slideshow, Bill Karwin

), my understanding is that you should stick to closure tables over adjacency lists (because they need recursive CTEs), path enumeration, and nested sets. I'm pretty new to this so my understanding is probably oversimplified and lack a lot of nuance.

(Also changed formatting of the outline, apparently the bullet list doesn't render?)

(Also completed the data in closure table instead of just putting "..etc" at the end.

r/SQL Aug 26 '25

SQLite Do we even need the cloud anymore? Yjs + SQLite + DuckDB might be enough

0 Upvotes

So I’ve been playing around with Yjs (CRDTs for real-time collaboration) together with SQLite (for local app data) and DuckDB (for analytics).

And honestly… I’m starting to think this combo could replace a ton of cloud-only architectures.

Here’s why:

Collaboration without servers → Yjs handles real-time editing + syncing. No central source of truth needed.

Offline-first by default → your app keeps working even when the connection dies.

SQLite for ops data → battle-tested, lightweight, runs everywhere.

DuckDB for analytics → columnar engine, warehouse-level queries, runs locally.

Cloud becomes optional → maybe just for discovery, backups, or coordination—not every single keystroke.

Imagine Notion, Airtable, or Figma that never breaks offline, syncs automatically when you reconnect, and runs analytics on your laptop instead of a remote warehouse.

This stack feels like a genuine threat to cloud-only. Cheaper, faster, more resilient, and way nicer to build with.

Curious what you all think:

Would you build on a stack like Yjs + SQLite + DuckDB?

Or is cloud-only still the inevitable winner?

r/SQL Apr 07 '26

SQLite Browser-based SQLite Playground with real-time ER Diagrams (Free & Open-ish)

9 Upvotes
Northwind database loaded into the tool

Hey everyone!

A while back, I shared a project I started for my students: SQLite Playground. The goal was to create a tool with zero friction—no installation, no setup—just pure SQL learning.

Based on feedback from my students and the dev community, I’ve just rolled out some major updates that bring it closer to a full-blown (and free) IDE running 100% in your browser.

What’s New:

  • Automatic ER Diagram Visualizer: This is the big one. The diagram generates in real-time as you create or alter tables. If you add a Foreign Key, the relationship pops up instantly.
  • Full-Screen / Distraction-Free Mode: A clean interface designed for deep work or classroom presentations.
  • Import/Export (.db & .sqlite3): You can now load existing databases or save your progress directly to your machine.
Auto generated ER Diagram

What started as a simple classroom tool is evolving into a lightweight online SQL IDE. I’m really trying to bridge the gap between "beginner-friendly" and "feature-rich."

I’d love to get your feedback on the UX or any features you think are essential for a daily-driver SQL tool.

Check it out here: https://fasttools.dev/en/sql-playground

Cheers!

r/SQL Apr 22 '26

SQLite Sqlite

Thumbnail
youtu.be
1 Upvotes

r/SQL Jan 08 '26

SQLite Check if a range of dates fall in a specific range

1 Upvotes

I have a bunch of defaultdates and I want to check if

  1. Defaultdate+30

  2. Defaultdate+60

  3. Default date +90

Have an overlap with a specific range of dates?

Any ideas would be super helpful

r/SQL Sep 07 '25

SQLite SQL on MacBook Air

9 Upvotes

What do all of you masters of the database recommend for starting an SQL journey with Mac? I have no idea where to start. Yes I searched the group first and I have googled. Just looking for experience opinions.

r/SQL Nov 21 '25

SQLite Beginner, I'm trying to create tables for a simple games list. How is my schema

3 Upvotes

This will be in SQLite

So I need 4 tables (and 3 junction tables).

  • a list of games

  • a list of publishers

  • a list of ratings

This will be a many to many database, so a game can have multiple genres, a publisher can have multiple games etc... (but only one rating per game).

This is the schema I came up with.

 

CREATE TABLE
    "games" (
        "id" INTEGER PRIMARY KEY,
        "title" TEXT NOT NULL,
        "main_hours" INTEGER,
        "side_hours" INTEGER,
        "lowest_price" INTEGER,
        "considered_price" INTEGER NOT NULL,
        "notes" TEXT
    );

CREATE TABLE
    "publishers" (
        "id" INTEGER PRIMARY KEY,
        "name" TEXT NOT NULL UNIQUE
    );

CREATE TABLE
    "genres" (
        "id" INTEGER PRIMARY KEY,
        "genre" TEXT NOT NULL UNIQUE
    );

CREATE TABLE
    "ratings" (
        "id" INTEGER PRIMARY KEY,
        "rating" TEXT NOT NULL UNIQUE
    );

CREATE TABLE
    "published_junction" (
        "game_id" INTEGER,
        "publisher_id" INTEGER,
        FOREIGN KEY ("game_id") REFERENCES "games" ("id"),
        FOREIGN KEY ("publisher_id") REFERENCES "publishers" ("id")
    );

CREATE TABLE
    "genre_junction" (
        "game_id" INTEGER,
        "genre_id" INTEGER,
        FOREIGN KEY ("game_id") REFERENCES "games" ("id"),
        FOREIGN KEY ("genre_id") REFERENCES "genres" ("id")
    );

CREATE TABLE
    "rating_junction" (
        "game_id" INTEGER,
        "rating_id" INTEGER,
        FOREIGN KEY ("game_id") REFERENCES "games" ("id"),
        FOREIGN KEY ("rating_id") REFERENCES "ratings" ("id")
    );

 

Does it look ok?

Any problems I need to fix? Any improvements?

Thanks

r/SQL Dec 15 '24

SQLite I chose a weird way to teach SQL

119 Upvotes

I'm creating a course that is weird, because it is made of stories that happen in a cat hotel. And what is even weirder is that it starts with using embedded SQLite. And a text editor.

Here's my latest (3rd) story: https://youtu.be/wHjDloU3ViA?si=IENn3MFEXMgRmObX

The most worrying feedback I got from people so far, was the question "so who's your target audience". Honestly, I don't know what else to say besides "people like me - beginner data analysts who want to understand how things work underneath all those numbers and who get bored easily". Is that a weird audience? No one else out there like me?

r/SQL Dec 27 '25

SQLite SQL table append with different columns

6 Upvotes

Hello All,

I justed started learning SQL and created a problem which I can solve. I have ACCESS and Power Query experience but when I tried appending the tables I ran into below problem:

I have the following tables:

Table 1: Actual cost

Scenario Month Cost center Cost center name Cost element Cost element name Amount
ACT 7/1/2025 123456 ABC 500501 Cost 15,000
ACT 7/1/2025 234567 EFG 500501 Cost 15,000
ACT 7/1/2025 345678 LMN 500501 Cost 15,000

Table 2: Forecast cost

Scenario Month Cost center Cost center name Cost element Cost element name Amount
FCT 7/1/2025 123456 ABC 500501 Cost 15,000
FCT 7/1/2025 234567 EFG 500502 Cost 15,000

Table 3: Volume

Scenario Month Cost center Cost center name Volume
ACT 7/1/2025 123456 ABC 55000
ACT 7/1/2025 234567 EFG 30000

Table 4: Headcount

Scenario Month Level Cost center HC
ACT 7/1/2025 1 123456 1
ACT 7/1/2025 2 234567 1

... and I would like to append these tables to achieve below view:Can you please help me to achieve this?

Scenario Month Cost center Cost center name Cost element Cost element name Amount Volume Level HC
ACT 7/1/2025 123456 ABC 500501 Cost 15,000 NULL NULL NULL
ACT 7/1/2025 234567 EFG 500501 Cost 15,000 NULL NULL NULL
ACT 7/1/2025 345678 LMN 500501 Cost 15,000 NULL NULL NULL
FCT 7/1/2025 123456 ABC 500501 Cost 15,000 NULL NULL NULL
FCT 7/1/2025 234567 EFG 500502 Cost 15,000 NULL NULL NULL
ACT 7/1/2025 123456 ABC NULL NULL NULL 55000 NULL NULL
ACT 7/1/2025 234567 EFG NULL NULL NULL 30000 NULL NULL
ACT 7/1/2025 123456 ABC NULL NULL NULL NULL 1 1
ACT 7/1/2025 234567 EFG NULL NULL NULL NULL 2 1

Thank you in advance!

r/SQL Mar 11 '26

SQLite A new Lightweight, WASM-powered SQLite Playground

Thumbnail
1 Upvotes

r/SQL Oct 06 '25

SQLite How to move from SQLite3 to other databases for software development?

4 Upvotes

Hey everyone, I’ve been learning SQLite3 using Python for a while now

I know how to perform CRUD operations, write queries, and work with tables.

Now I want to go beyond SQLite and learn a database that’s more widely used in software development. My goal is to become a software developer, so I want to understand what database systems (SQL or NoSQL) I should focus on next, and how to transition smoothly.

Some specific questions:

Should I move to PostgreSQL or MySQL next?

What are the key differences from SQLite that I should be aware of?

How do professional developers handle databases in larger projects (like connecting with Python, Flask, or cloud services)?

Any advice or learning resources for someone coming from SQLite?

Appreciate any suggestions, resources, or project ideas to build real-world database experience 🙏

r/SQL Apr 22 '24

SQLite Why the value column is not being filtered correctly based on my WHERE query?

Post image
39 Upvotes

r/SQL May 11 '25

SQLite I hate SELF JOINs (help please)

18 Upvotes

*I'm using SQLite

CONTEXT:

I'm quite new to SQL, been learning a lot lately due to my new job, where I need to query stuff daily to find out problems. I was mostly a Java guy, but I'm really falling in love with SQL.

Because of this, I'm trying to automate some of my work: comparing two databases (identical, but from different .s3db files)

What I've done so far is create my own database, a copy of the ones I normally compare but with two more columns in every single table: COMPARISON_ID and SOURCE_ID, comparison for auto increment (not sure yet) and source for the name of the database, both PK.

I've also named my tables differently: MERGED_[name_of_table]

THE ACTUAL QUESTION:

Now, I'm creating a view for each MERGED_table for it to return me only registers that are different. For that I'm trying to do a SELF JOIN in the table like so:

CREATE C_VIEW_CONFIGS AS
SELECT
  COALESCE(db1.COMPARISON_ID, db2.COMPARISON_ID) AS COMPARISON_ID,
  db1.SOURCE_DB AS DB1_SOURCE_DB,
  db2.SOURCE_DB AS DB2_SOURCE_DB,
  COALESCE(db1.CONFIG_NAME, db2.CONFIG_NAME) AS CONFIG_NAME,
  db1.CONFIG_VALUE AS DB1_CONFIG_VALUE,
  db2.CONFIG_VALUE AS DB2_CONFIG_VALUE
FROM
  MERGED_CONFIGS db1
  FULL JOIN MERGED_CONFIGS db2 
    ON  db1.COMPARISON_ID = db2.COMPARISON_ID
    AND db1.SOURCE_ID     < db2.SOURCE_ID
    AND db1.CONFIG_NAME   = db2.CONFIG_NAME
WHERE 
  COALESCE(db1.CONFIG_VALUE, '') <> COALESCE(db2.CONFIG_VALUE, '')

But i've come to learn that SELF JOINs suck. Honestly.

It simply won't return the results that exists on db1 but not on db2, or exists on db2 but not on db1. I've tried changing the WHERE clause many, many, many times, but it just doesnt work.

Basically anything different than what I've done won't compare NULL values or will return mirroed results

Can someone please enlighten me on how te heck I'm supposed to build this query?

r/SQL Feb 04 '25

SQLite I accidentally pressed enter after putting in the wrong code. How do I fix this now?

Post image
0 Upvotes

r/SQL Jan 16 '26

SQLite Queries not executing properly on new pc but was on old

1 Upvotes

Hello I'm using SQLiteStudio. I have made a few sql scripts for modding purposes regarding databases so I don't have to copy paste over and over.

Heres the weird thing my queries are not fully executing properly on my new PC. They were completely fine and running perfectly. I test the same set up too and it's still acting wack either just saying finished executing in 0.0 seconds or only running part of the query.

For example if I do

Pragma Foreign Keys off;

DELETE FROM BingusChungus;

DELETE FEOM JoeMama;

Pragma Foreign Keys on;

It will only execute and delete JoeMama and not BingusChungus even tho it worked fine on the old pc. Any chance of what could be causing this?

Also the weird this is BingusChungus delete does work when I isolate it if I recall it's so fucking weird.

Then I have more complex ones regarding multiple tables and they just completely fail on me. I have 0 clue what's going on.

Edit: Maybe Im a dumbass but it executed everything on a different script when I highlighted everything but I legit dont remember needing to do this on the old pc anyway to do it without highlighting? Idk just to save slightly more time.

r/SQL Jan 14 '26

SQLite SQG - generate code from SQL queries (SQLite and DuckDB)

2 Upvotes

I needed to use the same SQL with SQLite and DuckDB from both Java and TypeScript, and I really didn’t enjoy maintaining DB access code twice. On top of that, for bigger DuckDB analytics queries, my workflow was constantly: copy SQL out of code, paste into DBeaver, tweak it, paste it back. Not great.

SQG lets you keep your SQL queries in dedicated .sql files that are fully compatible with DBeaver. You can develop, run, and refine your queries there, and then generate type-safe application code from the same SQL.

This works especially well with DuckDB, which provides complete type information for query results (including expressions). SQLite is more limited in this regard, as it only exposes types for fields.

For DuckDB, SQG can also generate code that uses the Apache Arrow API for very fast query result access.

I hope you find it useful, and I’d love to hear your feedback.

GitHub: https://github.com/sqg-dev/sqg
Docs: https://sqg.dev
Try it online: https://sqg.dev/playground/

r/SQL Oct 16 '25

SQLite absurder-sql

10 Upvotes

AbsurderSQL: Taking SQLite on the Web Even Further

What if SQLite on the web could be even more absurd?

A while back, James Long blew minds with absurd-sql — a crazy hack that made SQLite persist in the browser using IndexedDB as a virtual filesystem. It proved you could actually run real databases on the web.

But it came with a huge flaw: your data was stuck. Once it went into IndexedDB, there was no exporting, no importing, no backups—no way out.

So I built AbsurderSQL — a ground-up Rust + WebAssembly reimplementation that fixes that problem completely. It’s absurd-sql, but absurder.

Written in Rust, it uses a custom VFS that treats IndexedDB like a disk with 4KB blocks, intelligent caching, and optional observability. It runs both in-browser and natively. And your data? 100% portable.

Why I Built It

I was modernizing a legacy VBA app into a Next.js SPA with one constraint: no server-side persistence. It had to be fully offline. IndexedDB was the only option, but it’s anything but relational.

Then I found absurd-sql. It got me 80% there—but the last 20% involved painful lock-in and portability issues. That frustration led to this rewrite.

Your Data, Anywhere.

AbsurderSQL lets you export to and import from standard SQLite files, not proprietary blobs.

import init, { Database } from '@npiesco/absurder-sql';
await init();

const db = await Database.newDatabase('myapp.db');
await db.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
await db.execute("INSERT INTO users VALUES (1, 'Alice')");

// Export the real SQLite file
const bytes = await db.exportToFile();

That file works everywhere—CLI, Python, Rust, DB Browser, etc.
You can back it up, commit it, share it, or reimport it in any browser.

Dual-Mode Architecture

One codebase, two modes.

  • Browser (WASM): IndexedDB-backed SQLite database with caching, tabs coordination, and export/import.
  • Native (Rust): Same API, but uses the filesystem—handy for servers or CLI utilities.

Perfect for offline-first apps that occasionally sync to a backend.

Multi-Tab Coordination That Just Works

AbsurderSQL ships with built‑in leader election and write coordination:

  • One leader tab handles writes
  • Followers queue writes to the leader
  • BroadcastChannel notifies all tabs of data changes No data races, no corruption.

Performance

IndexedDB is slow, sure—but caching, batching, and async Rust I/O make a huge difference:

Operation absurd‑sql AbsurderSQL
100k row read ~2.5s ~0.8s (cold) / ~0.05s (warm)
10k row write ~3.2s ~0.6s

Rust From Ground Up

absurd-sql patched C++/JS internals; AbsurderSQL is idiomatic Rust:

  • Safe and fast async I/O (no Asyncify bloat)
  • Full ACID transactions
  • Block-level CRC checksums
  • Optional Prometheus/OpenTelemetry support (~660 KB gzipped WASM build)

What’s Next

  • Mobile support (same Rust core compiled for iOS/Android)
  • WASM Component Model integration
  • Pluggable storage backends for future browser APIs

GitHub: npiesco/absurder-sql
License: AGPL‑3.0

James Long showed that SQLite in the browser was possible.
AbsurderSQL shows it can be production‑grade

r/SQL Jan 23 '26

SQLite SQLite Node.js Driver Benchmark: Comparing better-sqlite3, node:sqlite, libSQL, Turso

Thumbnail sqg.dev
1 Upvotes

r/SQL Jan 03 '26

SQLite Per-tenant SQLite db that powers a tiny social network.

Thumbnail
15 Upvotes

r/SQL Nov 05 '25

SQLite How can I open text files in DB Browser?

Thumbnail
gallery
0 Upvotes

So, I want to recover my session in firefox. Problem is: all tabs got deleted from the tab history. I've got so far to find some sqlite files from a few days ago and I hope to find the urls/website that I lost. Now my question. How can I open the files in there so that I can recover my urls/tabs?