-
Reference: http://www.linuxidc.com/Linux/2013-08/89155.htm
-
Installing Sqlite3sudo
-
Apt-get Install Sqlite3
-
Install the required toolkit for SQLITE3 compilation
-
If you need to, you can install the toolkit. Just to experience a piece, you can not install it. This option is optional.
-
Apt-get Install Libsqlite3-dev
-
The SQLite version number, such as 3.6.22, appears when you execute the following command
-
Sqlite3-version
-
To install the graphical interface (if you do not like the command line, it is necessary to install it.) This option is optional.
-
Sudo apt-get install sqlitebrowser
-
Run sqlitebrowser:$ sqlitebrowser
-
Install support for additional languages:
-
//php support sudo apt-get install php5-sqlite
-
//ruby supports sudo apt-get install libsqlite3-ruby
-
//python support Sudo apt-get install python-pysqlite2
-
Create a database (can be in any directory (such as/home/mark/database), execute the following command:)
-
Sqlite3 test.db (Note: After this command executes, if there is no test.db in the current directory, the file is created and used directly if it already exists.) Use. Database to view the databases created 650) this.width=650; "Src=" Http://www.linuxidc.com/upload/2012_05/120517091279721.gif " Vspace= "5" width= "581"/>
-
Create a table
-
Data type, you can refer to the official documentation.
-
CREATE TABLE MyTable (name varchar (ten), age smallint);
-
Similarly, use. table to see the table you created MyTable
-
Inserting data into a table
-
INSERT INTO mytable values (' Mark ',+);
-
INSERT INTO mytable values (' Hello ',+);
-
Querying data
-
SELECT * FROM MyTable;
-
Query Result:
650) this.width=650; "src=" Http://www.linuxidc.com/upload/2012_05/120517091279722.gif "/>
-
To delete a table:
-
drop table mytable;
-
To delete a database:
-
Unfortunately, SQLite is unable to delete the database file like any other database, that is, drop DB test, but we can delete the database file just like deleting a file, and delete the test.db file under/home/mark/database.
This article is from the "Mr_computer" blog, make sure to keep this source http://caochun.blog.51cto.com/4497308/1726536
Ubuntu-sqlite Install