ww的笔记之数据库基本操作
来源:互联网 发布:最好的防火墙软件 编辑:程序博客网 时间:2024/05/08 08:52
1.创建表
(1)create table Students(id varchar(16),name varchar(16),score varchar(6));
(2)create table if not exists Students(id varchar(16),name varchar(16),score varchar(6));
2.删除表
drop table Students;
3.插入
(1)insert into Students values(1,'YueBuQun',75);
(2)自增形式插入:inser into WuGong(name) values('zixiashengong');
4.查看
(1)查看单个表
select * from Students;(*代表查看所有字段,可以查看单个字段)
(2)查看多个表元素
select Students.id,Students.name,WuGong.name from Students,WuGong where Students.id=WuGong.id;
(3)条件查看
select * from Students where score>75 and score<90
(4)排序查看
1)正序
select * from Students order by score;
2倒序
select * from Students order by score desc;
(4)只看两条
select * from Students limit 2;
(5)查看有多少条数据
select count(*)from Students;
(6)平均分,总和分
select sum(score)from Students;
select div(score)from Students;
5.修改
update Students set score=90 where id=1;
6.删除
delete from Students where id=3;
7.设置主键和唯一键
(1)create table if not exists WuGong(id INTEGER primary key autoincrement,name TEXT unique);
(2)自增形式插入:inser into WuGong(name) values('zixiashengong');
- ww的笔记之数据库基本操作
- ww的笔记之FMDB操作类
- ww笔记-iOS之代码块(block)的使用
- MySQL 学习笔记 之 数据库基本操作
- MySQL数据库 之 数据库的基本操作
- ww笔记-iOS之自定义启动页
- mybatis笔记-1-数据库的基本操作
- 数据库之数据的基本操作
- unity之数据库的基本操作
- 随波逐流之IOS数据库的基本操作
- 数据库的基本操作之单列添加
- MySQL数据库 之 数据表的基本操作
- WW 的"原子弹"轰炸之说感想
- ww笔记-iOS之用Block替代代理传回push之后的值
- MySQL学习笔记之二:数据库和表基本操作
- android开发笔记之db数据库基本操作
- MYSQL 学习笔记 之 数据库基本操作2
- 数据库的基本操作之一些基本语句
- Android Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY的解决
- Android如何监听按键
- PPTPServer
- js时间倒计时
- 收藏
- ww的笔记之数据库基本操作
- Oracle导出表(即DMP文件)的两种方法
- CCActionCamera(摄像机动作)
- BZOJ [ZJOI2009]狼和羊的故事
- MQ简单实例
- 【C语言】16-预处理指令2-条件编译
- 尊重原创,请保证您的文章为原创作品尊重原创,请保证您的文章为原创作品
- DB2 未发出启动数据库管理器的命令
- CCActionCatmullRom(样条曲线动作 通过点数组自定义动作曲线)