Install SQLite in Ubuntu12.04 and Its Usage

Source: Internet
Author: User
Install and use SQLite on Ubuntu12.04.

Install and use SQLite on Ubuntu 12.04.

If you know how to learn embedded technology, you must understand the database. The embedded tutorials on the books you read are all in use. It seems that I cannot learn it, the following is a simple record of how to install and use SQLite on Ubuntu 12.04.

Related reading:

SQLite3 installation and basic operations

Simple Application of SQLite databases in Ubuntu 12.04

Install

1. First, create a folder. Here I name it sqlite, as shown in the following figure. Its path is/home/song/sqlite.

2. Go to the sqlite folder and execute the command: sudo apt-get install sqlite sqlite3. I watched the online installation of sqlite sqlite3. I wondered, isn't the latter upgraded, how can I install sqlite? If you don't need to experiment, install and use it first.

At this time, it has been installed. In fact, there is nothing to install.

3. Run the sqlite-version command to view the sqlite version.

At the same time, I also executed: sqlite3-version. Isn't there also a version? It is obvious that two versions are installed. I wonder if I need to support some files in the old format, so how can I install the format?

Use

Create a database

4. in this folder, run the command sqlite3 test. db to create a database named test. db, as shown in

5. You can enter the. help Command to view help information.

Create a data table (note that it is a data table, not a database. At least create a table in the database or try to save the database to the disk. Otherwise, the database will not be created)

6. Now input: create table mytable (id, name, age); (Note that you need to add points here) I created a data table named mytabel here, the data table defines three fields: id, name, and age.

Insert data to a data table

7. Execute the command: insert into mytable (id, name, age) values (1, "Zhang San", "21 ");

Insert into mytable (id, name, age) values (2, "Li Si", "23 ");

Query data tables

8. Execute the command: select * from mytable;

Set format

9. Run the command:. mode column (note that there is no semicolon) and set it to column Display mode.

10. Run the following command:

Exit Database

11. Run the following command:

Enter the database again

12. Execute the command sqlite3 test. db to open the database we just created

View database information

13. Run the. databases command to view the database information.

View the table information in the database

14. Execute the command:. tables. A table file is displayed in the database.

15. Run the following command: sudo apt-get install sqlitebrowser to install the visualization tool.

16. Execute the command: sqlitebrowser test. db. You can see our database.

Sqlite seems to have many other commands. I will post them first.

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.