1. Install sqlite3 Online First, try the command installation
[Email protected]:~$ sudo apt-get install sqlite3
2. Test will appear after successful installation
[Email protected]:~$ sqlite3
SQLite version 3.7.9 2011-11-01 00:52:41
Enter '. Help ' for instructions
Enter SQL statements terminated with a ";"
Sqlite>. Exit
3. Find the path to the Sqlite3
[Email protected]:~$ which sqlite3
/usr/bin/sqlite3
[Email protected]:~$ ls
Core OSLAB1 Public Videos
Desktop OSlab2 Qt Vmwaretools
Documents OSlab3 sqlite-amalgamation-3080403 WX
Downloads OSLAB4 Sqlite-amalgamation-3080403.zip wx3.0
Examples.desktop OSlab5 Stumana Wxlab
Music Pictures Templates
4. Examples of specific sqlite3 operations
[Email protected]:~$ mkdir mydb
[Email protected]:~$ CD mydb
[Email protected]:~/mydb$ ls
[Email protected]:~/mydb$ sqlite3 stu.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter '. Help ' for instructions
Enter SQL statements terminated with a ";"
Sqlite> CREATE TABLE stu (Sno int primary key, sname text NOT NULL, sage int);
sqlite> INSERT into Stu (1, ' Lisi ', 20);
Error:near "1": Syntax error
sqlite> INSERT into Stu values (1, ' Lisi ', 20);
sqlite> INSERT INTO Stu values (2, ' Zhangsan ', 18);
Sqlite> select * from Stu;
1|lisi|20
2|zhangsan|18
Sqlite>. Exit
[Email protected]:~/mydb$ ls
Stu.db
5. Examples of specific sqlite3 operations
[Email protected]:~$ cd Stumana
[Email protected]:~/stumana$ sqlite3 stuinfo.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter '. Help ' for instructions
Enter SQL statements terminated with a ";"
Sqlite> CREATE TABLE Stuinfo (id char), name char (1) Not Null,dormitoryid char (a) not Null,phone Char 3));
sqlite> INSERT into stuinfo values (' 1115115247 ', ' LiYa ', ' 15#501 ', ' 15530061772 ', ' 614100932 ');
sqlite> INSERT into stuinfo values (' 1115115276 ', ' Zhangaihua ', ' 15#424 ', ' 18330000036 ', ' 627100056 ');
Sqlite> select * from Stuinfo;
1115115247| liya|15#501|15500761772|614100932
1115115276| zhangaihua|15#424|18330000036|627100056
Sqlite>. Exit
[Email protected]:~/stumana$ ls
Bin Stuinfo.db Stumana.depend WXWIZFRAME.FBP
GUIFrame.cpp StuManaApp.cpp stumana.layout WxWizFrame.fbp.bak
GUIFrame.h StuManaApp.h StuManaMain.cpp
Obj STUMANA.CBP StuManaMain.h
[Email protected]:~/stumana$