30 C
Texas
angeloma
Senior Writer and partner

Install SQLite on Debian 11

Hello, friends. In this post, we will show you how to install SQLite on Debian 11.

SQLite is a small, reliable, and very fast database engine. It is one of the most efficient database engines in the world. In part, thanks to that made in C Language which makes it very efficient in managing the resources of the system.

In like manner, the development of SQLite is so important that many major companies participate in it. This is done through the SQLite Consortium. In addition, all the code is available to be downloaded, viewed, and reused for being open source.

So, let us start.

Install SQLite on Debian 11

- Advertisement -

SQLite has outstanding Linux support. Proof of this is that it is present in most of the existing distributions. In this sense, Debian 11 also has this privilege.

So, open a terminal or from a terminal interface, update the whole system.

sudo apt update
sudo apt upgrade

Then, you can search inside the repositories for all the packages that are related to SQLite.

sudo apt search sqlite

The next step is to install SQLite by executing the following command

sudo apt install sqlite3

Once you have completed the installation, you can verify the version that has been installed.

sqlite3 --version
3.34.1 2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ealt1

This way, the installation has been successful,

Using SQLite to test the installation

Now, let’s use a little SQLite to check that everything went well. First, let’s create a new database

sqlite3 example.db

Since example.db does not exist then it will be created. The second time you want to access it, it will not be created.

Now I will create a new table with some fields. The important thing is to test the operation.

sqlite> CREATE TABLE Student
               (
               Id VARCHAR(25) NOT NULL,
               Name VARCHAR(25) NOT NULL,
               Last_Name VARCHAR(25) NOT NULL,
               Age INTEGER(2) NOT NULL,
               CONSTRAINT pk_Student PRIMARY KEY (Id)
               );

Also, check that the table has been created, showing the database tables.

sqlite> .tables
Student

Now add some data to the table.

sqlite> INSERT INTO Student (Id, Name, Last_Name, Age) VALUES ('Xy01','Jon','Snow',18);

And finally, display them.

sqlite> SELECT * FROM Student;
1.- Using SQLite on Debian 11
1.- Using SQLite on Debian 11

Now, you can use SQLite to make projects. Type .exit to close SQLite shell. Enjoy it!

Conclusion

SQLite is a great database application and if we learn to use it, it would be a great help for our projects. Installing it is very easy and gives us a lot of work possibilities. In this post, you learned how to install it and give some steps to use it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article