加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

SQLite数据库在终端的常用命令总结

发布时间:2020-12-12 19:29:22 所属栏目:百科 来源:网络整理
导读:学了SQLite数据库 打开SQlite数据库 如果没有的话创建: sqlite3 per.db;//打开SQlite数据库: 1. .tables查看里面是否内容; 2. create table file(表名)(id int,name varchar,age int);//创建表 3. insert into file (id,name,age) values(1,‘小明’,

学了SQLite数据库

打开SQlite数据库 如果没有的话创建:

sqlite3 per.db;//打开SQlite数据库:

1.

.tables查看里面是否内容;

2.

create table file(表名)(id int,name varchar,age int);//创建表

3.

insert into file (id,name,age) values(1,‘小明’,18)//file里插入内容;。

4.

.select *from per.db//查询file里的内容 *表示所有的字段;

.help //显示所有信息

5.

.open file.db 回车 .database 回车 //获取file路径

6.

update file set name =‘张明’ where id =1; //where 表示条件,当id=1时;

7.

create table student (id integer,primary key auto increment,name varchar);//设置主键,只能有一个,不能重复,

设置值

insert into student(name)values(’小明’)//结果:1|小明;

insert into student(name)values(’小明’)//结果:

1|小明

2|小明;

insert into student(id,name)values(10,’小明’)//结果:

1|小明

2|小明;

10|小明;

8.更新 某个表里的字段

update student set name=‘张明’ where id=1;

//结果:1|张明

9.删除 记录

delete *from student where id=2 //只是把表的记录删了

10.删除 student 这个表

drop table student

11.

select name from student //只输出 student的name值

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读