创建表
代码语言:javascript复制sqlite> create table test ( id int primary key not null, name text );
sqlite> .tables
test
sqlite> .schema test
CREATE TABLE test ( id int primary key not null, name text );
sqlite>
sqlite> insert into test values(1,"hello");
sqlite> insert into test values(2,"hello");
sqlite> insert into test values(3,"hello");
sqlite> select * from test;
1|hello
2|hello
3|hello
sqlite>
代码语言:javascript复制Tip: 以点开头的管理命令,如
.tables
和.schema
是不能接;
的,而增删改查类操作是必须要以;
结尾的
sqlite> .table
test
sqlite> .table;
Error: unknown command or invalid arguments: "table;". Enter ".help" for help
sqlite> insert into test values(4,"hello");
sqlite> insert into test values(5,"hello")
...>
...>
...>
...>
...>
...>
...>
...> ;
sqlite> insert into test values(5,"hello")
...>
...>
...>
...>
...>
...>
...> ;
Error: UNIQUE constraint failed: test.id
sqlite>