SQLite database tutorial on Linux platform (i)--end use

Source: Internet
Author: User
Tags sqlite sqlite database

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:
    1. A simple query:

    2. To set the display mode to list mode:

    3. Query in INSERT statement mode:

    4. Set the display mode to line mode (see Help for more modes):

    5. To change the delimiter:

    6. Add a field to the header (on is on, off to turn off the option):

    7. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.