- SQLite — Installation
- Install SQLite on Windows
- Install SQLite on Linux
- Install SQLite on Mac OS X
- How to Install and Basic SQLite Use on Linux
- Installing Sqlite
- Create Database
- Create Table
- Inserting Data
- Fetching data
- Special commands to sqlite3(dot -commands)
- Writing results to a file
- Как установить SQLite и браузер SQLite в Ubuntu
- Установка SQLite в Ubuntu
- Создание базы данных и таблицы SQLite
- Установка браузера SQLite в Ubuntu
- Удаление SQLite и браузера SQLite
- How to install SQLite 3 in Ubuntu 20.04 and Linux Mint 20
- Installing SQLite 3 in Ubuntu 20.04 and Linux Mint 20
- Step 1: Update apt repository cache
- Step 2: Update apt-cache
- Step 3: Install SQLite 3
- Step 4: Verify the installation
- Installing SQLite browser in Ubuntu 20.04 and Linux Mint 20
- Step 1: Update apt repository cache
- Step 2: Install SQLite browser on your Ubuntu 20.04 and Linux Mint 20
- Step 3: Launch SQLite browser
- Removing SQLite 3 from Ubuntu 20.04 and Linux Mint 20
- Conclusion
- About the author
- Kamran Sattar Awaisi
SQLite — Installation
SQLite is famous for its great feature zero-configuration, which means no complex setup or administration is needed. This chapter will take you through the process of setting up SQLite on Windows, Linux and Mac OS X.
Install SQLite on Windows
Step 1 − Go to SQLite download page, and download precompiled binaries from Windows section.
Step 2 − Download sqlite-shell-win32-*.zip and sqlite-dll-win32-*.zip zipped files.
Step 3 − Create a folder C:\>sqlite and unzip above two zipped files in this folder, which will give you sqlite3.def, sqlite3.dll and sqlite3.exe files.
Step 4 − Add C:\>sqlite in your PATH environment variable and finally go to the command prompt and issue sqlite3 command, which should display the following result.
Install SQLite on Linux
Today, almost all the flavours of Linux OS are being shipped with SQLite. So you just issue the following command to check if you already have SQLite installed on your machine.
If you do not see the above result, then it means you do not have SQLite installed on your Linux machine. Following are the following steps to install SQLite −
Step 1 − Go to SQLite download page and download sqlite-autoconf-*.tar.gz from source code section.
Step 2 − Run the following command −
The above command will end with SQLite installation on your Linux machine. Which you can verify as explained above.
Install SQLite on Mac OS X
Though the latest version of Mac OS X comes pre-installed with SQLite but if you do not have installation available then just follow these following steps −
Step 1 − Go to SQLite download page, and download sqlite-autoconf-*.tar.gz from source code section.
Step 2 − Run the following command −
The above procedure will end with SQLite installation on your Mac OS X machine. Which you can verify by issuing the following command −
Finally, you have SQLite command prompt where you can issue SQLite commands for your exercises.
Источник
How to Install and Basic SQLite Use on Linux
In this article, We will see how to install SQLite (relational database) with its basic operations. What if I tell you that SQLite is likely used more than all other database engines combined. Yes, You heard it right. It is the most widely deployed database in the world with millions and billions of copies.
The reason behind this popularity is some unique characteristics that are unusual and which makes it different from many other SQL database engines like MySQL, PostgreSQL, Oracle, Microsoft SQL Server, etc. Let’s get started with it. First, We will install it on Linux and later on cover basic database operations.
Installing Sqlite
To install on your Debian based (Ubuntu, Debian, etc.) machine execute below commands.
To install on your RPM-based (RHEL, CentOS, Fedora etc.) machine execute below commands.
You may also install SQlite using the DNF package manager:
Now Open a terminal and Execute «sqlite3», you will see the following lines with prompt.
The very first line shows the version and release date and time of sqlite3.
The second line tells to enter «.help» for instructions.
.help command list all the meta commands and their descriptions. These meta commands are also called «dot» commands because they are preceded by a dot.
Put «.help» to prompt
Before explaining these dot commands, let’s see some of the basic database operations.
First run «.quit» command to end the session.
Create Database
Execute below command on shell prompt.
It will create «example.db» (You can put your choice of name in place of «example.db») database file ( if not exists). If exists then open the database contained in the file.
The difference between «sqlite3» and «sqlite3 dbname.db» command is the first one will create a temporary database for the session and will expire when the session is closed.
Create Table
Let’s create a student table with attributes:
reg_no int(4)
Name varchar(20)
Marks int(3)
enter the following commands in terminal
It will create a student table with above attributes.
You can see the list of tables in the selected database by .table command
There is only one table student in my case.
You can also see the schema of the table using .schema table_name
Inserting Data
Let’s insert 3 records in the table
101, pradip, 87
102, Avinash, 86
103, Rakesh, 90
Enter the following command one by one
Fetching data
You can fetch data from table with select statement
It shows the result in default mode (list).
You can change the mode with .mode command
Enter .mode column to prompt and then perform select query. It will show the result in a column format.
Delete, Alter, Drop etc have same syntax as sql.
Special commands to sqlite3(dot -commands)
We saw «.help» commands list all the dot commands. Let’s understand some other important commands.
Shows name of database selected.
List the tables in the selected database.
Shows the current settings
You can show attribute name in query result by running .header ON|OFF command
The Program is able to show the results of a query in eight different formats: «csv», «column»,»html»,»insert», «line», «list», «tabs», «tcl»..mode command is use to switch between these output formats.
You can use .separator command to change separator.
sqlite> .separator —
> select * from student;
reg_no-name-marks
101-Pradip-87
102-Avinash-86
103-Rakesh-91
Writing results to a file
by default, It sends query results to standard output.
you can change this using «.output» and «.once» commands.
Just put the name of an output file as an argument to .output and all subsequent query results will be written to that file.
Or use the .once the command with file name if you want only the result of next query to be redirected.
We have successfully installed SQLite on Linux with basic operations. These operations are only a few out of all available. We can’t cover all of them in this article. If you find any difficulties in an installation or in any command, Let me know in the comment section.
Источник
Как установить SQLite и браузер SQLite в Ubuntu
SQLite — это легкая, небольшая и автономная СУБД. Популярные базы данных, такие как MySql, PostgreSQL и т. д. работают как клиент — сервер, и у них есть специальный процесс, выполняющий и контролирующий все аспекты работы базы данных.
А SQLite не имеет запущенного процесса и не имеет модели клиент — серверной. SQLite DB — это просто файл с расширениями .sqlite3 .sqlite .db. Каждый язык программирования имеет библиотеку для поддержки SQLite.
SQLite используется в таких программах как:
- Веб-браузеры (Chrome, Safari, Firefox).
- MP3-плееры, приставки и электронные гаджеты.
- Устройства на Android, Mac, Windows, iOS и iPhone.
Областей где используется SQLite очень много. Например каждый смартфон в мире имеет сотни файлов базы данных SQLite. На наш взгляд это довольно большое количество. Пока приступить к установке db.
Установка SQLite в Ubuntu
Настройка и установка SQLite очень проста, по сравнению с другими популярными базами данных, такими как MySql, Postgresql и т. д. Во-первых, обновите apt-cache, выполнив следующую команду.
Теперь проверьте, есть ли какие нибудь пакеты SQLite, которые доступны в репозитории apt. Для этого выполнив следующую команду.
Чтобы установить SQLite, выполните следующую команду.
Вы можете проверить установку, для этого запустите сеанс sqlite. Это можно сделать выполнив следующую команду.
Как видно из приведенного выше изображения, SQLite3 успешно установлен и работает с версией 3.33.0..
Создание базы данных и таблицы SQLite
База данных хранится в виде файла в вашей файловой системе. Вы можете создать базу данных при запуске сеанса sqlite, указав имя базы данных в качестве аргумента. Если БД доступна, она откроет базу данных, если нет, то создаст новую базу данных.
Если мы не передаем имя БД в качестве аргумента, то создается временная база данных в памяти, которая будет удалена после завершения сеанса. Здесь у меня нет никакой базы данных, поэтому я создам новую БД, упомянув имя db в качестве аргумента. Как только вы подключитесь к сеансу, вы можете запустить команду .databases, чтобы увидеть, какой файл прикреплен к базе данных.
$ sqlite3 /home/tecmint/test # создание тестовой базы данных в /home/tecmint
sqlite> .databases #команда для того чтобы увидеть, какой сеанс базы данных подключен
Теперь давайте создадим пример таблицы, выполнив следующие запросы.
# create table
sqlite> CREATE TABLE employee(
Name String,
age Int);
# Insert records
sqlite> insert into employee(Name, age)
VALUES (‘Tom’,25),
(‘Mark’,40),
(‘Steve’,35);
Вы можете запустить команду .tables, чтобы вывести список таблиц в базе данных.
sqlite> .tables # отображает список таблиц в базе данных
sqlite> .headers on # включить столбец для печати
sqlite> SELECT * FROM employee; # выбор записи из таблицы
Установка браузера SQLite в Ubuntu
Теперь, когда мы как установили и настроили sqlite3, мы также установим sqlite browser. Это простой графический инструмент для управления базами данных sqlite.
$ sudo apt install sqlitebrowser -y
Вы можете запустить приложение из меню «Пуск» или из терминала. Для запуска браузера из терминала выполните следующую команду.
Удаление SQLite и браузера SQLite
Для удаления SQLite, так и SQLite browser потребуется выполнить следующую команду.
$ sudo apt —purge remove sqlite3 sqlitebrowser
Вот и все. Если у вас есть какие-либо отзывы или советы, пожалуйста, используйте раздел комментариев, чтобы опубликовать их.
Источник
How to install SQLite 3 in Ubuntu 20.04 and Linux Mint 20
SQLite is a free, lightweight, and command-line database application. It is an efficient database engine that is implemented in C. It is a cross-platform database application. Like SQL and MySQL, SQLite is also a relational database. It is widely used in combination with Android and web applications. SQLite is leveraged with an SQLite browser. SQLite Browse is a graphical and free software platform for developing and designing, SQLite databases. In this post, you will get to know the installation procedure of SQLite 3 and SQLite Browser on Linux Mint 20 Ubuntu 20.04.
Installing SQLite 3 in Ubuntu 20.04 and Linux Mint 20
To install SQLite 3 on Ubuntu 20.04 and Linux Mint 20, perform the following steps:
Step 1: Update apt repository cache
Before installing any application or package, it is recommended to update the system apt repository cache using the following command:
Step 2: Update apt-cache
Next, upgrade the apt repository cache using the following command:
Step 3: Install SQLite 3
Alright! Now we are ready to install SQLite 3 on Ubuntu 20.04 and Linux 20. SQLite is available through Ubuntu 20.04 and Linux Mint 20 repositories. Install SQLite 3 using the following command:
Step 4: Verify the installation
After installing SQLite 3, we can view the installed version of SQLite 3. Additionally, it also verifies the installation. Run the below-given command to do so:
Installing SQLite browser in Ubuntu 20.04 and Linux Mint 20
The SQLite browser can be installed in Ubuntu 20.04 and Linux Mint 20 through the below-given steps:
Step 1: Update apt repository cache
Before installing the SQLite browser, update the system’s apt repository cache with the following command:
Step 2: Install SQLite browser on your Ubuntu 20.04 and Linux Mint 20
The SQLite browser can be installed by executing the following command:
The command line will display a prompt. You are supposed to press “y” to continue the installation process. However, if you want to cancel the installation process then press ‘n’ and hit enter.
Step 3: Launch SQLite browser
After the successful installation, click on the application menu and search for SQLite browser and open it.
It is the main window of SQLite bowser.
Removing SQLite 3 from Ubuntu 20.04 and Linux Mint 20
At any point, if you want to remove or uninstall the SQLite 3 from your system, run the following command to do so:
Conclusion
SQLite 3 is a free and efficient database engine. This article explains how to install SQLite 3 on Ubuntu 20.04 and Linux Mint 20.
About the author
Kamran Sattar Awaisi
I am a software engineer and a research scholar. I like to write article and make tutorial on various IT topics including Python, Cloud Computing, Fog Computing and Deep Learning. I love to use Linux based operating systems.
Источник