SQLite database tutorial on Linux platform (1)-Terminal Use, linuxsqlite

Source: Internet
Author: User

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.

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.