Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an sqlite database using command line shell in windows

Tags:

sqlite

I have my sqlite3.exe file in C:\ and i want to create an sqlite database in C:\db\sqlite.I have tried sqlite3 ex1 as suggested on the docs http://www.sqlite.org/sqlite.html but i get the error Error Near "sqlite3".

What is the correct way of creating a new database from the shell?.

like image 366
Gandalf Avatar asked Oct 19 '11 08:10

Gandalf


People also ask

How do I create a SQLite database in Windows?

SQLite CREATE Database In this SQLite tutorial, here is how you can create a new database: Open the Windows Command Line tool (cmd.exe) from the start, type “cmd” and open it. From the Installation and packages tutorial, you should now have created an SQLite folder in the “C” directory and copied the sqlite3.exe on it.

How use SQLite command-line in Windows?

Start the sqlite3 program by typing "sqlite3" at the command prompt, optionally followed by the name the file that holds the SQLite database (or ZIP archive). If the named file does not exist, a new database file with the given name will be created automatically.

What is the command used to create a database in SQLite?

In SQLite, sqlite3 command is used to create a new SQLite database.


1 Answers

As new file is created in current directory, for creating file at different location you should follow this format:

eg. for storing file FILENAME.db at c:/users/xyz/abc you should type

sqlite>.open c:/users/xyz/abc/FILENAME.db

and then press enter a new file will be created at the mentioned path.

and now when you will type .databases you will see your file listed in the list of databases.

like image 102
mnttnm Avatar answered Sep 30 '22 11:09

mnttnm