This Document
This is an explanation of how to use TiddlyWiki as a combination of relational database and web display. There are many other ways to use TiddlyWiki, but this is a powerful technique.
This is mostly aimed at those who already understand relational databases and SQL, and many of the lessons are meant to show how to convert such knowledge to use within TiddlyWiki. But other TiddlyWiki users interested in the technique should be able to glean a fair bit from it.
Prerequisites
To understand this, you should already have a reasonable grasp of Tiddlywiki. You should be able to create a wiki, add new tiddlers, and perform some minimal customization of your wiki. Of course, if you do have some expertise, I would appreciate any suggestions, guidance, corrections, etc. (scott@sauyet.com) You do not need any deep expertise, however. This is aimed at SQL users, but I'm hoping that others can still generally follow along.
Using TiddlyWiki as a Relational Database
TiddlyWiki is many things. It's front page tells us to
Use it to keep your to-do list, to plan an essay or novel, or to organise your wedding. Record every thought that crosses your brain, or build a flexible and responsive website.
But it is so much more. People use it to keep track of their recipes, write and publish books, record their genealogies, document software systems, maintain bibliographies, record their exercise regimes, curate lists of all sorts, and so much more.
For those who've used tools like Microsoft Access, there's some interesting overlap. But while Access focuses on creating relational databases, with some ability to present data, TiddlyWiki instead focuses on being a great way to present information. The information it displays is contained in the same file you're working on.
At it's core, TiddlyWiki is a way to store and present data, a combination of database and presentation engine.
What is a relational database?
A database is an organized collection of data structured for quick search and retrieval. A relational database organizes its data into tables of rows and columns, much like spreadsheets.
What is SQL?
Structured Query Language (SQL) is a declarative language used to define, manipulate, and query data stored in a relational database. If you've seen queries like the following, you've seen SQL:
SELECT FirstName, LastName, City
FROM Customer
How Does TiddlyWiki Fit In?
The basic unit of TiddlyWiki is the *tiddler*. A tiddler is a collection of name-value pairs. Most prominent is the text
field, and after that the tags
. But there are arbitrarily many fields allowed, and they can be structured as you like. A set of similarly-structured tiddlers can easily represent a certain kind of data.
While a shared tag is most common, there are other ways to group tiddlers as a table. That's an advanced topic we may or may not cover.
By using a shared tag for the tiddlers organized in a particular way, we can treat that tag as a close equivalent to a table in a relational database. This document explores how to do so.
What's to Come
There are two main strands of content included:
- A tutorial on how to mimic many aspects of SQL in Wikitext
There are many Example of converting SQL to Wikitext. You can look directly at these or follow along as they are used in the tutorial - An explanation on how this document itself acts as a relational database.
You can check this out by following the explanation or by poking around and following the links starting from any of the tables, especially one of the orders.