HomeLinuxSet up and Use SQLite on Rocky Linux 9

Set up and Use SQLite on Rocky Linux 9


SQLite is a light-weight and widely-used Relational Database Administration System or RDMS which is understood for its simplicity, pace, and reliability. It was developed to supply an environment friendly, dependable, quick resolution for numerous database necessities. In contrast to different client-server programs, SQLite is serverless, which implies that you would be able to implement the whole database system because the library. Furthermore, you’ll be able to hyperlink and entry these libraries from the SQLite software. Therefore, whether or not you’re a developer or a corporation, SQLite can effectively deal with your knowledge storage and administration wants. If you wish to learn to set up and setup SQLite in your Rocky Linux machine, this tutorial is for you. Right here, we included a whole course of to put in and use SQLite on Rocky Linux 9.

Set up and Use SQLite on Rocky Linux 9

Earlier than putting in SQLite in your gadget, there are some stipulations that you might want to comply with:

    • A working Rocky Linux 9 server
    • Administrative entry or a consumer account with sudo privileges
    • Secure web connectivity to obtain the SQLite packages

Let’s begin the method by updating the system as per the newest replace:

 
SQLite is on the market within the Further Packages for Enterprise Linux (EPEL) repository. So, set up the EPEL repository utilizing the next command:

sudo dnf set up -y epel-release

 

As soon as you put in the EPEL repository, execute the next command to put in SQLite:

 

As soon as you put in the SQLite, you’ll be able to verify its model by executing the next command:

 

Use the SQLite

Now, let’s discover some primary instructions to create and work together with a database. For instance, run the next command to create a brand new database file:

 

This command creates a brand new database file, “MY_DATA.db”, within the present listing. Nevertheless, if you wish to create a database file in one other listing, make that particular listing the present one within the terminal. For instance, if you wish to create a database file within the Paperwork listing, run the next command:

cd ~/Paperwork
sqlite3 DATA.db

 

For instance, let’s create a desk by executing the SQL instructions. Right here, we create a “College students” desk that has ID, title, and e-mail:

CREATE TABLE College students (
  id INTEGER PRIMARY KEY,
  title TEXT,
  e-mail TEXT
);

 

So as to add the information into the desk, use the INSERT INTO assertion. Right here’s an instance:

INSERT INTO College students (Title, E-mail) VALUES (‘Jason’, ‘jase99@gmail.com’);
INSERT INTO College students (Title, E-mail) VALUES (‘Paul’, ‘kcpaul45@gmail.com’);

 

To retrieve the information from the desk, use the SELECT assertion. Right here’s an instance:

 

This command shows all data within the “College students” desk. You’ll be able to change or delete the information in a desk. For instance, to replace a consumer’s e-mail, you’ll be able to execute the next:

UPDATE College students SET E-mail = ‘jasek99@gmail.com’ WHERE id = 1;

 

To delete a consumer from the desk, use the DELETE command:

DELETE FROM College students WHERE id = 2;

 

Lastly, you’ll be able to exit the SQLite shell by means of the next command:

 

Extra SQLite Options

SQLite provides quite a few superior options and functionalities for extra complicated database operations. Some notable options embody:

    • Transactions: SQLite helps ACID-compliant transactions for knowledge consistency and integrity.
    • Indexing: You’ll be able to create the indexes to boost a question efficiency.
    • Views: SQLite means that you can create digital tables that are often called views to simplify the complicated queries.
    • Triggers: Triggers can be utilized to execute actions mechanically throughout the prevalence within the database.
    • Import and Export: SQLite gives instructions like “.import” and “.output” to import the information from exterior recordsdata or export the question outcomes to recordsdata.

These options make SQLite a robust selection for numerous purposes, starting from cellular apps to embedded programs and small-scale internet purposes.

Conclusion

That is all concerning the strategies to put in and use SQLite on Rocky Linux 9. SQLite’s simplicity, pace, and reliability make it a best option for numerous purposes. Leverage the superior options like transactions, indexing, views, and triggers to optimize your database operations. Adhere to one of the best practices to make sure a strong and safe SQLite setting.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments