Installation and use of SQLite database on Linux platform
SQLite is a lightweight database, it is designed to be embedded, and it has been used in many embedded products, it occupies a very low resource, it may only need hundreds of K of memory is enough. can support Windows/linux/unix and so on mainstream operating system, and can be combined with many programming languages, such as TCL, C #, PHP, Java, and ODBC interface.
Installation
In Terminal input:
sudo apt-get install sqlite3
The general system is self-contained and does not require manual installation.
We can also choose to install graphical interface programs, such as Sqlitebrowser:
sudo apt-get install sqlitebrowser
After the installation is complete, review the version:
sqlite3 -version
Here, our installation is over.
The basic command describes creating or opening a database:
We set up the First.db database file, which is normally stored in the current directory. Open if the database file exists.
To view the SQL command that created the database:
To create a data table:
Here I created a stdtable data table with SID, Sname, sage three fields.
Note:You must add a line footer.
To insert data into a data table:
Here, the information for Jack and rose two students is added separately.
Querying data tables:
A simple query:
To set the display mode to list mode:
Query in INSERT statement mode:
Set the display mode to line mode (see Help for more modes):
To change the delimiter:
Add a field to the header (on is on, off to turn off the option):
Replaces the null value of the output with the specified string
Querying database information:
Query the table information in the database:
The SQL script that forms the database is displayed in the terminal (the SQL script that forms the table is appended with the table name):
Print the output to a file (default = stdout):
Executes the SQL statement in the specified file:
Delete:
To delete a table:
Backing Up the database
Recovering a Database
Help:
Exit:
Visualize the database:
Summarize
Here are some simple and common commands, there are many commands are not involved, including some functions, I hope you use the time to view more help.
Feedback and Suggestions
- Weibo: @AnSwEr not the answer
- Github:answerywj
- Blog: answer is not the answer
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
SQLite database tutorial on Linux platform (i)--end use