SQLite database administration

In this section, we are going to learn how to install and use SQLite. Python has the sqlite3 module to do SQLite database tasks. SQLite is a serverless, zero configuration, transactional SQL database engine. SQLite is very fast and lightweight. The entire database is stored in a single disk file.

Now, we will install SQLite first. Run the following command in your Terminal:

$ sudo apt install sqlite3

In this section, we are going to learn following the operations: creating database, creating tables, inserting data into table, retrieving the data, and updating and deleting the data from table. We will see each operation one by one.

Now, first, we will see how to create a database in SQLite. To create a database, you simply have to write the command in your Terminal as follows:

$ sqlite3 test.db

After running this command, you will get the sqlite console opened in your Terminal as follows:

student@ubuntu:~$ sqlite3 test.db
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
sqlite>

There you go, your database has been created by simply running sqlite3 test.db.

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

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