Installation

To install SQLite on the Pi, run the command:

sudo apt-get update
sudo apt-get install sqlite3

To verify the installation, run this:

sqlite3 -version

If all went well, this command should print the current version of sqlite installed.

Starting a an SQLite database is as simple as running the following:

sqlite3

This will open the sqlite3 shell:

SQLite version 3.19.3 2017-06-08 14:26:16
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite>

You are now in a fully functional SQL shell and can execute most of the SQL commands that you are familiar with if you have used other SQL-based databases. When you run SQLite 3 like this, it runs an in-memory database without storing it permanently (as hinted in the opening logs of the shell).

To run the database with persistent storage, provide an argument to the sqlite3 command, indicating the location of the file that you want SQLite to use in order to store data:

sqlite3 ~/.sqlite.db

From this point on, this is the command you can use to start the SQLite database, and .sqlite.db is the file that we direct SQLite to use in order to store its data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.196.27