数据库DDL语句
2015-12-19 14:55
176 查看
SQLite 将数据划分为以下几种类型:integer,整型值, real浮点型,text文本字符串,blod二进制数据。
实际上SQLite是无类型的。除主键外
创建表
creat table if not exists t_student (id integer primary key autoincrement,name text,age integer,score real);
删除表
drop table if exists t_student
插入数据
insert into t_student (name,age,score) values ('Jack',12,100); id会自动增长
将SQL语句写入文件
[sql writeToFile:@"/User/apple/Desktop/student.sql" atomically:YES encoding:NSUTF8StringEncoding error:nil];
条件语句
更新语句
updata t_student set score = 60 where age < 20 and name != 'jack';
删除
delete from t_student where age <= 10 or age > 30;
查询所有数据
select * from t_student;
实际上SQLite是无类型的。除主键外
创建表
creat table if not exists t_student (id integer primary key autoincrement,name text,age integer,score real);
删除表
drop table if exists t_student
插入数据
insert into t_student (name,age,score) values ('Jack',12,100); id会自动增长
将SQL语句写入文件
[sql writeToFile:@"/User/apple/Desktop/student.sql" atomically:YES encoding:NSUTF8StringEncoding error:nil];
条件语句
更新语句
updata t_student set score = 60 where age < 20 and name != 'jack';
删除
delete from t_student where age <= 10 or age > 30;
查询所有数据
select * from t_student;
相关文章推荐
- mysql 排序 /tmp被撑爆
- mysql创建数据库和删除数据库
- 深入解析MySQL的事务隔离及其对性能产生的影响
- Mongodb的安装(Mac)以及相关宝贵资料
- mysql 的 find_in_set函数使用方法
- 新版数据库分页方法(Sql server2012)
- golang SQLDriverConnect: {IM005} [Microsoft][ODBC 驱动程序管理器] 驱动程序的 SQLAllocHandle on SQL_HANDLE_DBC 失败
- 数据库_Mysql_mysql中char,varchar与text类型的区别和选用
- redis String类型的操作
- Oracle归档日志总结
- redis中key的操作和数据库的选择
- Redis配置集群二(window)
- 《Sams Teach Yourself SQL in 10 Minutes》学习笔记
- Oracle中是用case...when语句进行判断
- 打造先进的内存KV数据库-2 B树索引的建立(2)
- 关于NoSQL与SQL的区别
- SQL2008R2的 遍历所有表更新统计信息和索引重建
- Redis深入学习(1)前言&Redis简介
- MyBatis使用动态SQL批量插入数据
- MySql安装