Gice

Technology and General Blog

We have normally heard of MySQL, MariaDB, and PostgreSQL, but not about SQLite. SQLite is a tiny, light-weight, yet strong SQL Database Supervisor. In this post, we will discover all about what SQLite is and how we can set up SQLite on CentOS 8 functioning technique.

SQLite does not operate as a system service like other DBMS. So, it is regarded as a self-contained database supervisor that does not get the job done like other DBMS, this kind of as MySQL, PostgreSQL, and MariaDB.

SQLite is crafted dependent on the C language to make it an efficient and rapid database administration method. Its binaries in all important running units are accessible like Windows, Linux, and macOS, so it is a multi-system and open up-supply application.

Installation of SQLite on CentOS 8

SQLite is obtainable in the default package supervisor of the CentOS 8 running technique and conveniently downloadable and installable from there.

But just before that, it is an excellent apply to make absolutely sure that your technique is up-to-date. To improve the mounted deals and dependencies, execute the command typed down below:

Soon after upgrading, make sure that the epel-release is enabled as nicely on your CentOS 8 functioning technique. If it is not enabled, you can execute the command under to enable the epel-release:

$ sudo dnf put in epel-release

As soon as the epel-release is enabled, execute the up grade command at the time all over again to make the packages up-to-day:

When the technique is up-to-date and all set, we can put in SQLite on CentOS 8 by executing the solitary command.

For setting up the most current and stable version of SQLite from the DNF bundle supervisor, execute the command:

$ sudo dnf install sqlite

SQLite will be downloaded and set up in a handful of times.

After the installation of SQLite on CentOS 8 is concluded, you can affirm the installation by executing the command provided underneath:

It is verified that SQLite’s model 3.26 is efficiently put in on CentOS 8 working system. Now, let us get commenced with SQLite in CentOS 8 and find out about its major utilization.

Getting Begun With SQLite on CentOS 8

For receiving started with SQLite on CentOS 8, simply execute the “sqlite3” command in the terminal of CentOS 8 to get into the shell of SQLite:

Once you are logged in the SQLite shell, it is encouraged you very first consider a look at the Aid web site of SQLite to get know-how about the SQLite instructions.

We will attempt to operate some primary commands to produce a databases, a table and insert some knowledge into a desk in SQLite.

How to Generate a Databases in SQLite

Considering the fact that the SQLite database is saved as a file, we can make an SQLite database working with the “sqlite3” command.

Even though logging into the SQLite shell, we will need to mention the title of the database we want to use. If there is no databases with the supplied title, a new databases file will be produced. If we do not present any databases title, a momentary in-memory database will be established. Notice: the short-term in-memory database will be terminated when the SQLite session will be shut.

For illustration, to develop “testdb” databases in SQLite, the command would go like this:

Following executing the previously mentioned command, a new database with the name “testdb” will be made in the recent performing listing. You will be immediately logged into the SQLite session. You can execute the command “.databases” to know which database is related:

You can see in the screenshot earlier mentioned that the database file is created in the /home/user listing, and the SQLite session is connected to the “testdb”. So, you can also offer the path together with the databases title to produce and log in to the database session.

Soon after building the databases, the following stage is to make a desk.

How to Make a Table in SQLite

Given that SQLite is an SQL-centered databases management process, the Produce Desk command is employed for creating a table.

For case in point, to create a desk with the name of “test_student” in the SQLite, the Build Table command would be like this:

sqlite> Develop Table test_student(
   …> title String,
   …> age Int
   …> )

A new “test_table” will be designed, and you can validate the generation of the table in SQLite by executing the “.tables” command:

You can see and witness in the output that the “test_student” desk is stated as a end result of the “.tables” command.

Now, let’s see how to put data in an SQLite table.

Inserting Data Into a Table in SQLite

Insertion of data in an SQLite desk is as effortless as executing it in any other SQL-centered database management procedure. Insert knowledge into the “test_student” table the INSERT INTO command will be used.

For illustration, we want to include some new students into the “test_student” table so that the command would go like this:

sqlite> INSERT INTO exam_university student(title, age)
   …> VALUES (‘John’, 16),
   …> (‘Bob’, 18),
   …> (‘Ivan’, 14)

How to Perspective a Desk Knowledge in SQLite

Now, to see the recent point out of the table, use the Pick out * FROM table_title command:

sqlite> Find * FROM exam_university student

You can see in the output that the three inserted rows are displayed.

Conclusion

In this write-up, we have learned to put in SQLite databases administration procedure in the CentOS 8 operating method. Setting up the SQLite motor on CentOS 8 is as easy as setting up any other bundle from the DNF offer repository on CentOS 8.

Moreover, in this straightforward starter’s guideline, we have uncovered the most important usage and executed some beginner-degree commands like developing a databases in SQLite, developing a desk, and inserting details into a table in the SQLite database management system.

Leave a Reply

Your email address will not be published. Required fields are marked *