SQLite database tutorial on Linux platform (1)-Terminal Use, linuxsqlite
SQLite database tutorial on Linux platform (1)-terminal usage
SQLiteIt is a lightweight database, designed to be embedded, and is currently used in many embedded products, it occupies very low resources, it may only take several hundred KB of memory. Supports mainstream operating systems such as Windows, Linux, and Unix, and can be combined with many programming languages, such as Tcl, C #, PHP, Java, and ODBC interfaces.
Install
Enter at the terminal:
sudo apt-get install sqlite3
Generally, it is self-contained in the system and does not need to be manually installed.
You can also choose to install graphical interfaces, such as sqlitebrowser:
sudo apt-get install sqlitebrowser
After the installation is complete, view the version:
sqlite3 -version
Here, our installation has come to an end.
Basic commands:
We have created the first. db database file, which is usually stored in the current directory. Open the database if the database file exists.
View the SQL command for creating a database:
Create a data table:
Here I created a data table named stdtable, which contains three fields: sid, sname, and sage.
Note:; The end of the row must be added.
Insert data into a data table:
Here, we will add information about Jack and rose respectively.
Modify data:
Query data table: query database information:
Query the table information in the database:
Display the current display format Configuration:
Configuration file:
With the configuration file, you do not need to open the database every time and then configure it. Location:/home/. sqliterc.
The SQL script that forms the database is displayed on the terminal (the SQL script that forms the table is followed by the table name ):
Print the output to a file (stdout by default ):
Run the SQL statement in the specified file:
Delete:
Delete table:
Back up the database:
Restore database:
Help:
Exit:
View the database visually:
Summary
Some simple and commonly used commands are listed here, and many other commands are not involved, including some functions. I hope you can check more help when using them.
Feedback and suggestions
- Weibo: @ AnSwEr is not the AnSwEr
- Github: AnSwErYWJ
- Blog: AnSwEr is not the AnSwEr Column
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.