Reputation: 645
I am new to SQLite. I downloaded the latest version of SQLite (both shell and dll) and extract them to my D:
drive. I execute the 'sqlite3.exe' file by double clicking on that.
When I try to create the database with the command sqlite3 test.db;
, I get this error.
D:\Android Work\Sqlite\sqlite-shell-win32-x86-3070800>sqlite3.exe
SQLite version 3.7.8 2011-09-19 14:49:19
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> sqlite3 test.db
...> ;
Error: near "sqlite3": syntax error
sqlite>
Please help me..
Upvotes: 8
Views: 24911
Reputation: 4254
when you type sqlite3 in the terminal or cmd you're getting into SQLite command prompt which doesn't allow you to create DB
so quit from cmd or terminal using this command .quit
now run the following command to create a new DB "sqlite3 siya.db" where "siya" is the database name and check created database using the following command .databases(to check all the databases)
Upvotes: 1
Reputation: 1
open cmd and type cd\ and then C:>cd sqlite C:\sqlite>sqlite3 test.db SQLite version 3.39.2 2022-07-21 15:24:47 Enter ".help" for usage hints. sqlite> .databases main: C:\sqlite\test.db r/w sqlite>
Upvotes: 0
Reputation: 171
If you're seeing sqlite>
then you are inside SQLite. You need to come out with .quit
and then type sqlite3 testDB.db
to create a database file managed with SQLite
Example below:
sqlite> sqlite3 testDB.db
...> CREATE TABLE first(a int, b string);
Error: near "sqlite3": syntax error
sqlite> .quit
C:\Users\>sqlite3 testDB.db
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
sqlite> .databases
main: C:\Users\testDB.db
sqlite>
Upvotes: 3
Reputation: 74320
I believe you have to type "sqlite3 test.db" from the command line prompt, not from inside the interactive SQLite interface.
See here:
$ sqlite3 test.db
SQLite version 3.0.8
Enter ".help" for instructions
sqlite> .quit
$
Upvotes: 15