SQLite Manager icon

SQLite Manager

Manage SQLite databases and execute queries

Create Database

AI-generated

Summary

Create a new SQLite database file with a specified name, optionally overwriting an existing file, and execute initial SQL commands after creation.

Inputs

  • Database Name (required) — Set the name of the SQLite database file; a .db extension is automatically appended if omitted.
  • Overwrite If Exists — Toggle whether to truncate the database file if it already exists instead of failing.
  • Initial SQL — Provide optional SQL statements to run immediately after creating the database to initialize schema or data.

Output shape

a single JSON object containing metadata about the created database, including its filename, path, creation status, and overwrite status.

If the database already exists and overwrite is false, the operation throws an error. The initial SQL is only executed if provided and after the database file is created or truncated.

Examples

Example 1: Create a new database file named 'example' adding default .db extension, running table creation SQL, and overwriting if the database exists.

Database Name: example; Overwrite If Exists: true; Initial SQL: 'CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT);'

Discussion