从终端创建数据表
切换到数据库目录
apple@appledeMacBook-Pro:cd /Users/apple/Desktop/Workspace/iOS/07-iPhone/SQLite/DB
apple@appledeMacBook-Pro:~/Desktop/Workspace/iOS/07-iPhone/SQLite/DB$ sqlite3 MyDB.db
SQLite version 3.8.5 2014-08-15 22:37:57
Enter ".help" for usage hints.
SQLite编辑目录
sqlite> .tables
创建表
sqlite> CREATE TABLE
...> IF NOT EXISTS T_Test(
...> id integer NOT NULL,
...> name text NOT NULL,
...> hometown text
...> );
查看数据库中所有的表
sqlite> .tables
T_Test
向表中添加数据
sqlite> INSERT INTO T_Test (id, name, hometown) VALUES (1, 'Tom', 'BEIJING');
查询
sqlite> SELECT id, name, hometown FROM T_Test;
1|Tom|BEIJING
结束编辑
sqlite> .quit