Web SQL is a deprecated browser API for storing structured data in a local SQLite database. You open it with openDatabase(), then run SQL inside db.transaction() via tx.executeSql().
Use this hub to learn the core ideas, try a live demo (when the API exists), then open the focused CRUD tutorials: INSERT, SELECT, UPDATE, and DELETE.
Deprecated API.
Web SQL is obsolete and removed from modern Chrome. Firefox never shipped it. Prefer IndexedDB for new offline storage. Keep this series for legacy maintenance and SQL learning.
vs IndexedDB.
Web SQL uses SQL strings and tables. IndexedDB uses object stores and JavaScript objects. Same-origin only—one site cannot read another site’s database.
Vocabulary
Key Concepts
Term
Meaning
Database
Top-level container opened with openDatabase(name, version, displayName, size)
Table
SQL table created with CREATE TABLE (columns + types)
Transaction
Atomic unit of work: db.transaction(callback)
executeSql
Runs one SQL statement with optional ? bindings
Result set
Success callback receives (tx, result) with rows, rowsAffected, insertId
Bound params
Pass values as an array—never concatenate user input into SQL
Seed with INSERT OR REPLACE so repeat clicks stay safe.
Read with SELECT ... WHERE id = ? and show the name.
Continue with UPDATE and DELETE tutorials for the rest of CRUD.
Edge Cases & Pitfalls
Most beginner bugs come from missing feature detection, unbound SQL, or forgetting transactions.
legacy
API may be missing
Always check window.openDatabase. Modern Chrome has no Web SQL.
tx
SQL needs a transaction
Every executeSql call must run inside db.transaction() (or readTransaction for reads).
inject
Bind with ?
Never concatenate user input into SQL strings. Pass values in the arguments array.
rows
Use rows.item(i)
result.rows is array-like. Prefer item(i) and length—do not assume forEach works.
WHERE
Missing WHERE is dangerous
UPDATE / DELETE without WHERE changes or removes every row in the table.
Compatibility
Browser Support
Web SQL is a deprecated client-side API. Firefox never shipped it. Chrome removed it (about Chrome 97+). Detect with window.openDatabase before running demos.
✓ Deprecated
Web SQL API
Educational / legacy only. Prefer IndexedDB for new production apps.
LegacyModern browser support
Google ChromeRemoved ~97+
Removed
Mozilla Firefox—
Never supported
Apple SafariLegacy
Historical / limited
Microsoft EdgeRemoved
Removed (Chromium)
OperaRemoved
Removed (Chromium)
Samsung InternetLegacy
Do not rely on
Internet Explorer—
Not supported
Web SQLDeprecated
Bottom line: For new web apps, use IndexedDB. Keep Web SQL only for maintaining old codebases.
Remember
Key Takeaways
Role: Web SQL ran SQLite in the browser—now deprecated.
Path: learn INSERT → SELECT → UPDATE → DELETE; prefer IndexedDB for new work.
One line: open a DB, run SQL inside transactions, then move new apps to IndexedDB.
Frequently Asked Questions
Web SQL Database is a deprecated browser API that stores structured data in a local SQLite database. You open it with openDatabase() and run standard SQL statements (CREATE TABLE, INSERT, SELECT, UPDATE, DELETE) inside db.transaction() using tx.executeSql().
Web SQL is deprecated and removed from most modern browsers, including current Chrome. Firefox never implemented it. Treat this tutorial as educational for legacy code; use IndexedDB for new projects.
The W3C stopped standardizing Web SQL because it relied on a single vendor's SQLite implementation, making cross-browser behavior hard to guarantee. IndexedDB became the recommended client-side database API.
The Web SQL API requires every executeSql call to run within db.transaction(). Transactions group statements atomically—if one fails, the whole transaction can roll back, keeping data consistent.
Use IndexedDB for new browser storage. It is supported across modern browsers, handles larger datasets, and works with structured JavaScript objects. localStorage is fine for simple key-value strings only.