前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SQLite 基础6

SQLite 基础6

作者头像
franket
发布2021-12-01 17:16:27
2170
发布2021-12-01 17:16:27
举报
文章被收录于专栏:技术杂记

创建表

代码语言: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> 

Tip: 以点开头的管理命令,如 .tables.schema 是不能接 ; 的,而增删改查类操作是必须要以 ; 结尾的

代码语言:javascript
复制
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> 

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 创建表
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档