HTML Web SQL

You are Here:

What is Web SQL?

Web SQL is a database for storing data that can be queried using a variant of SQL.

Note: Web SQL is deprecated and is no longer recommended. Instead, try to use IndexedDB.

How to view Web SQL?

Follow the below steps to view your data stored in the Web SQL:

  1. Go to Developer Tools or Press F12 or Press Ctrl + Shift + i.
  2. Switch to Application Tab on the top navigation bar.
  3. On the left side menu you will find the Web SQL.

Note: If you couldn't find your recent changes in the Web SQL database, close and reopen the developer tools to see the changes.

In the following example, we will create a Web SQL database.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <button type="button" onclick="createDB()">Create DataBase</button> <script type="text/javascript"> function createDB(){ var db = openDatabase('studentsDB', '1.0', 'Test DB', 2 * 1024 * 1024); if(db) alert("Your DB was created"); else alert("Something went wrong."); } </script> </body> </html>

Syntax

openDatabase(DB_Name, Version_Number, Text_Description, DB_Size);

Parameters

ParameterTypeExplanation
DB_NamestringSpecifies the name of the database.
Version_NumberstringSpecifies the version number of the database.
Text_DescriptionstringSpecifies the text description of the database.
DB_SizeNumberSpecifies the size of the database.

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author