Share Runnable SQL With Anyone - No Setup Required

Turn your SQL queries into shareable links that anyone can run instantly in their browser. Perfect for teaching, collaborating, and exploring data together.

6 min read

dbxlite runs DuckDB in your browser. Queries can use inline data, remote CSV/Parquet files, or public datasets - no database server needed. This makes SQL instantly shareable via URL.

SQL as a Shareable Link

sql.dbxlite.com lets you encode SQL directly into a URL. When someone opens that link, they see your query and can run it instantly - no installation, no database setup, no accounts.

Here's a simple example. This link runs a query that generates the numbers 1 through 10:

https://sql.dbxlite.com/?sql=SELECT%20*%20FROM%20range(10)&run=true

Click it. The query runs automatically. The recipient sees both your code and the results. That's it.

Here are a few more to try:

Why This Matters

For teachers and mentors: Instead of saying "write a query that does X," you can show exactly what you mean. Students can modify the query, run variations, and learn by doing - all without leaving their browser.

For teams: Share a query that analyzes a public dataset. Your colleague opens the link during a meeting and everyone sees the same results in real-time.

For learners: Found a clever SQL pattern on Stack Overflow? Wrap it in a dbxlite link and save it to your notes. When you need it again, it's not just code - it's a working example you can run and modify.

For bloggers and educators: Embed runnable SQL in your articles. Readers don't just read about window functions - they execute them.

Two Ways to Share

Method 1: Direct URL (Quick and Simple)

For short queries, encode the SQL directly in the URL. Add &run=true to auto-execute.

Step 1: Write your SQL

SELECT
  strftime(now(), '%A, %B %d, %Y') as today,
  strftime(now(), '%H:%M:%S') as current_time

Step 2: URL-encode it (any online tool works, or use encodeURIComponent() in JavaScript)

Step 3: Build your link

https://sql.dbxlite.com/?sql=YOUR_ENCODED_SQL&run=true

The &run=true parameter means the query executes automatically when the link opens. Without it, the recipient sees the query but needs to click Run.

Practical limit: URLs work best under 1,500 characters. For longer queries, use Gists.

Method 2: GitHub Gist (For Longer Queries)

GitHub Gists are perfect for complex queries. They're version-controlled, support multiple files, and have no length limit.

Creating a shareable Gist:

  1. Go to gist.github.com
  2. Paste your SQL
  3. Name the file query.sql (the .sql extension matters)
  4. Click "Create secret gist" (or public, your choice)
  5. Copy the gist ID from the URL

The gist ID is the long string at the end of the URL:

https://gist.github.com/hfmsio/74a00550758b3c12f2abe8b762125769
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                               This is the gist ID

Your shareable link:

https://sql.dbxlite.com/?share=gist:74a00550758b3c12f2abe8b762125769&run=true

Try this real example now:

This gist contains a window functions example that demonstrates:

WITH sales AS (
  SELECT * FROM (VALUES
    ('2025-01-01', 'alpha', 120),
    ('2025-01-02', 'alpha', 150),
    ('2025-01-03', 'alpha', 90),
    ('2025-01-04', 'alpha', 300),
    ('2025-01-01', 'beta', 200),
    ('2025-01-03', 'beta', 50),
    ('2025-01-04', 'beta', 400),
    ('2025-01-05', 'beta', 80),
    ('2025-01-06', 'beta', 120),
    ('2025-01-07', 'beta', 180)
  ) AS t(sale_date, category, amount)
),
enriched AS (
  SELECT
    sale_date::DATE AS sale_date,
    category,
    amount,
    -- Rolling 7-day sum within each category
    SUM(amount) OVER (
      PARTITION BY category
      ORDER BY sale_date
      ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
    ) AS rolling_7d_amount,
    -- Rolling 7-day average
    AVG(amount) OVER (
      PARTITION BY category
      ORDER BY sale_date
      ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
    ) AS rolling_7d_avg,
    -- Cumulative sum (running total)
    SUM(amount) OVER (
      PARTITION BY category
      ORDER BY sale_date
      ROWS UNBOUNDED PRECEDING
    ) AS cum_amount,
    -- Rank by amount within category
    RANK() OVER (
      PARTITION BY category
      ORDER BY amount DESC
    ) AS rank_within_category
  FROM sales
)
SELECT * FROM enriched ORDER BY category, sale_date;

What this query teaches:

  • CTE (WITH clause): The sales CTE creates sample data inline using VALUES - no file needed
  • Window functions: SUM() OVER, AVG() OVER, RANK() OVER calculate values across rows
  • PARTITION BY: Separates calculations by category (alpha vs beta)
  • ROWS BETWEEN 6 PRECEDING AND CURRENT ROW: Creates a rolling 7-day window
  • ROWS UNBOUNDED PRECEDING: Running total from the first row
  • RANK(): Ranks each sale by amount within its category

Anyone with this link can run the query. They don't need a GitHub account.

Query Real Data From Anywhere

The real power comes from combining shareable links with remote data. DuckDB (the engine behind dbxlite) can query CSV and Parquet files directly from URLs.

Example: Analyze diamond prices from a public dataset

SELECT
  cut,
  count(*) as diamonds,
  round(avg(price), 2) as avg_price,
  round(avg(carat), 2) as avg_carat,
  rank() OVER (ORDER BY avg(price) DESC) as price_rank
FROM 'https://raw.githubusercontent.com/tidyverse/ggplot2/main/data-raw/diamonds.csv'
GROUP BY cut

Run this query now

That link:

  • Fetches 54,000 rows of diamond data from GitHub
  • Runs your analysis with window functions
  • Shows results instantly

All in the browser. No data upload. No database.

Customize the Experience

Pick a Theme

Add &theme= to set the editor color scheme. Try these links to see each theme in action:

Dark Themes:

ThemeDescriptionTry It
draculaPurple accents, popular with developersOpen in Dracula
nordArctic blue tones, easy on the eyesOpen in Nord
tokyo-nightPurple and blue, modern aestheticOpen in Tokyo Night
catppuccinWarm pastels, cozy codingOpen in Catppuccin

Light Themes:

ThemeDescriptionTry It
github-lightClean white, familiar to GitHub usersOpen in GitHub Light
solarized-lightWarm cream background, classic readabilityOpen in Solarized
ayu-lightMinimal white, bright and cleanOpen in Ayu

Name the Tab

Add &tab= to give the query a descriptive name (URL-encode spaces as %20):

sql.dbxlite.com/?sql=...&run=true&tab=Sales%20Analysis

Show the File Explorer

Add &explorer=true to display the schema explorer panel:

sql.dbxlite.com/?share=gist:abc123&run=true&explorer=true

Use Cases

Teaching SQL Concepts

Create a progression of links, each building on the last:

  1. Basic SELECT: ?sql=SELECT%20*%20FROM%20range(5)&run=true
  2. Add filtering: Link with WHERE clause
  3. Introduce aggregation: Link with GROUP BY
  4. Window functions: Link with RANK() and LAG()

Students can follow along, modify queries, and experiment - all without installing anything.

Code Review

Spotted a performance issue? Create a link showing the slow query and another showing the optimized version. Both run against the same data, making the improvement obvious.

Data Journalism

Writing about trends in public data? Instead of static screenshots, link to live queries. Readers can verify your analysis, tweak parameters, or explore further.

Interview Prep

Create a collection of SQL challenges. Each link contains a problem setup. Candidates can solve it in their browser while you watch.

Personal Knowledge Base

Save interesting queries as Gists. Your notes become a library of runnable examples, not just code snippets that might be outdated.

Tools for Sharing

Bookmarklet: One-Click Gist to dbxlite

How to install: Click and drag the button below to your bookmarks bar. (Show bookmarks bar: Cmd+Shift+B on Mac, Ctrl+Shift+B on Windows)

Run in dbxlite

How to use: When viewing any GitHub Gist containing SQL, click the bookmarklet in your bookmarks bar. It extracts the gist ID and opens it in dbxlite with auto-run enabled.

Badge for READMEs

Add a "Run in dbxlite" badge to your GitHub repositories:

[![Run in dbxlite](https://img.shields.io/badge/Run%20in-dbxlite-blue)](https://sql.dbxlite.com/?share=gist:YOUR_GIST_ID&run=true)

Replace YOUR_GIST_ID with your actual gist ID. The badge looks like this:

Run in dbxlite

URL Generator

Use our Share Page to generate shareable links without manually URL-encoding. Paste your SQL or Gist URL, pick a theme, and get a ready-to-share link.

Tips for Effective Sharing

Add comments to your SQL. The recipient sees your code - make it readable.

-- Calculate 7-day rolling average of daily sales
-- Uses window function with ROWS BETWEEN
SELECT
  date,
  sales,
  avg(sales) OVER (
    ORDER BY date
    ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
  ) as rolling_avg
FROM daily_sales

Test your link before sharing. Open it in an incognito window to see exactly what recipients will experience.

Use Gists for anything complex. If your query has multiple CTEs or joins, the readability of a Gist beats a cramped URL.

Consider run=true carefully. Auto-run is great for demos but might be surprising for complex queries that take time. Sometimes letting users click Run is better UX.

Get Started

  1. Go to sql.dbxlite.com
  2. Write a query
  3. Use the Share button to generate a link (creates a Gist automatically)
  4. Send that link to anyone

No account needed. No installation. Just SQL that runs.


The next time someone asks "can you show me that query?" - send them a link they can actually run.