Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A relational database using <table> tags and jQuery
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
README.markdown formatting README


Today I was thinking aloud about Tree Regular Expressions and how they might make a nice query language for document databases like CouchDB. Someone pointed out that CSS3 selectors might make a great concrete syntax for this. One thing lead to another and I thought, why not build a relational database in HTML? So I did. I even got inner joins working.

Let's start with a few tables:

<table class="users">
    <td class="id">1</td>
    <td class="first_name">amy</td>
    <td class="last_name">bobamy</td>
<table class="photos">
    <td class="id">1</td>
    <td class="user_id">1</td>
    <td class="url"></td>

Now we can express some queries:


This is equivalent to SELECT * FROM users WHERE id = 1

  .select('.id, .name')

This is equivalent to SELECT id, name FROM users WHERE id = 1. Here is something slightly more complicated:


But here is the crowning glory, the inner join:


This is equivalent to:

SELECT photos.url FROM users, photos
WHERE photos.user_id =
  AND = 1

Download the fun at Github.

Something went wrong with that request. Please try again.