SQLite Create Database
SQLite Create Database
The SQLite sqlite3 command is used to create a new SQLite database. The database is stored in a single cross-platform disk file.
Syntax
The general syntax to create a database using the command line is as follows:
/> sqlite3 <database file name>
Example
Open the Windows command prompt.
If you want to create a new database <mydatabase.db>, then the following SQLite statement is used:
/> sqlite3 mydatabase.db
SQLite database files have the extension “.db” or “.sqlite” or “.sqlite3”. However, SQLite does not enforce any specific file extension, and you can use any extension. For example, if you have a SQLite database named “mydatabase,” the file storing the database could be named:
- mydatabase.db
- mydatabase.sqlite
- mydatabase.sqlite3
Once a database is created, you can cross-check it in the list of databases using the SQLite .databases command. This command will list the SQLite databases.
Common issue
The common error while trying to create a database is as follows:
sqlite3 is not recognized as an internal or external command, operable program or batch file.
The error occurs when SQLite is not installed on the machine. Follow the instructions to set up SQLite on the computer.
Add the SQLite installation folder to the PATH environment variable if you still encounter the issue.
—
SQLite Tutorials
SQLite tutorials on this website:
https://www.testingdocs.com/sqlite-database-tutorials/