Sqlite 安装&基本操作
来源:互联网 发布:计算定积分软件 编辑:程序博客网 时间:2024/06/15 17:19
最近搞sqlite 数据库,整理一下,备忘。
1. 安装
sudo yum install sqlite-devel;
2.基本操作:
建立数据库 sqlites test.db;
创建数据表 create table TestTable(id int primery key, name varchar(20));
向表中插入数据 insert into TestTable(id,name)values(1,“Tom”);
查询 .mode column 将表的列设置为显示
.header on 显示列名
select * from TestTable
id name
1 Tom
3. Sqlite 基本语句
判断数据库中是否存在某个表:select 1 from sqlite_master where type = 'table' and name = 'book';
判断表中是否存在某字段:select 1 from sqlite_master where type = 'table' and name= 'book' and sql like '%idtest%';
建表语句:create table book(id VARCHAR(20) PRIMARY KEY , name VARCHAR(100), info VARCHAR(100));
添加字段:alter table book ADD descinfo VARCHAR(100);
创建索引:create index book_index1 on book(id);
添加:insert into book(id, name, info) values('01', 'Qt编程', '这是一本好书');
删除:delete from book where id = '01';
更新:update book set name = 'test' where id = '01';
精确搜索:select * from book where id = '01';
模糊搜索:select * from book where name like '%:strBookName%' ESCAPE '!';
4.在终端显示数据库
定位到要创建或者是打开的数据库文件所在目录 sqlite3 test.db;
之后在执行显示所有表 .tables;
查询数据 select * from TestTable;
阅读全文
0 0
- Sqlite 安装&基本操作
- SQLite数据库安装及基本操作指南
- sqlite数据库基本操作
- android---sqlite基本操作
- sqlite 基本操作指令
- SQLite数据库基本操作
- Android SQLite基本操作
- sqlite 基本操作指令
- SQLite常用基本操作
- Sqlite的基本操作
- SQLite 入门, 基本操作
- SQLite基本操作
- SQLite基本操作
- sqlite 基本操作
- sqlite基本操作
- sqlite基本操作命令
- SQLite基本操作
- Sqlite的基本操作
- vue如何在sublime text 中变成彩色
- final
- 利用ScrollView实现图片缩放
- 编译dll时debug和release版命名不同遇到的问题
- mongo脚本文件
- Sqlite 安装&基本操作
- Spark集群完全分布式安装部署
- bash小代码
- SAPI SDK的介绍
- AES 原理
- ICMP Flood 攻击、UDP Flood 攻击、SYN Flood 攻击
- glide加载图片的时候不能正常显示,时大时小.
- [leetcode: Python]15.3Sum
- Java密码加密