Read-only Back to SQLite3 Guide
Northwind Traders

Microsoft's classic sample database, converted to SQLite. Northwind is a small company that imports speciality foods and resells them. It has customers, orders, products, suppliers, staff and sales territories, all joined by keys. Click any table to browse it, follow a key to the row it points at, or write your own query in the SQL console.

This is a demonstration, and nothing here can be changed. You can browse and query freely; any statement that would write is refused. To practise INSERT, UPDATE and DELETE, download northwind.db and open it with sqlite3 northwind.db. The Northwind tab of the SQLite3 guide walks through everything the database was built to teach.
13
Tables
16
Views
3308
Rows in all tables
1996–98
Order dates
How the tables connect
Click a table to open it
Tables
13 tables
Microsoft's views
Saved queries, translated from T-SQL
How this demo stays read-only

The SQL console runs whatever you type, so it is protected in four separate ways. Any one of them would be enough on its own.

  1. The file is opened with mode=ro&immutable=1. SQLite opens it read-only and never takes a lock on it.
  2. PRAGMA query_only = ON makes SQLite refuse any statement that would write.
  3. An authorizer callback checks every statement as it is compiled. It allows only reads, function calls and a few introspection pragmas such as PRAGMA table_info, and it refuses ATTACH, so a query can't open any other file on the server.
  4. The operating system: the web server's user account has no write permission on the file.

Each query is also stopped after 2 seconds and returns at most 500 rows, so one visitor can't tie up the server.