How to use SQLite database under Ubuntu 12.04
Editor to share with you how to use the SQLite database under Ubuntu 12.04, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
A simple example of SQLite development under Ubuntu 12.04 is as follows:
1. Install SQLite3
Hadron@hadron ~ $sudo apt-get install sqlite sqlite3
2. Check the version number
Hadron@hadron ~ $sqlite3-version
3. Create a test database
Hadron@hadron ~ $sqlite3 test.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
Sqlite >
4. View the database
Sqlite > .database
Seq name file
0 main / home/hadron/test.db
5. Create a data table
Sqlite > create table user (id,username,password)
6. Insert data
Sqlite > insert into user (id,username,password) values (1)
7. Query data
Sqlite > select * from user
1 | abc | 123
8. Exit the database
Sqlite > .exit
9. Enter the database again
Hadron@hadron ~ $sqlite3
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
Sqlite >
10. Install visualization tools:
Hadron@hadron ~ $sudo apt-get install sqlitebrowser
These are all the contents of this article entitled "how to use SQLite Database under Ubuntu 12.04". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!