For example, running SQLite3 with the new database name mydb.sqlite3
and creating the table person
as shown below can create the new database mydb.sqlite3
:
sqlite3 mydb.sqlite3
...
sqlite> CREATE TABLE person(id integer, name text);
And, you can do the above with one line of command as shown below:
sqlite3 mydb.sqlite3 'CREATE TABLE person(id integer, name text)'
Or:
sqlite3 mydb.sqlite3 "CREATE TABLE person(id integer, name text)"
Be careful, only running SQLite3 with the new database name mydb.sqlite3
as shown below cannot create the new database mydb.sqlite3
:
sqlite3 mydb.sqlite3
In addition, you can create the empty database mydb.sqlite3
with ''
or ""
as shown below:
sqlite3 mydb.sqlite3 ''
Or:
sqlite3 mydb.sqlite3 ""
.exit
to exit. Very useful to know! – Bollen