摘要: 使用union可以将多个select 语句的查询结果集组合成一个结果集。select 字段列表1 from table1union [all]select 字段列表2 from table2...说明:字段列表1与字段列表2的字段个数必须相同,且具有相同的数据类型。合并产生的新结果集的字段名与字段列 阅读全文
posted @ 2016-09-22 17:56 D.零下的小书屋 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 聚合函数: select avg(salary)//平均值 from wsb; select sum(salary)//总和 from wsb; select max(salary)//最大 from wsb; select min(salary)// 最小 from wsb; select cou 阅读全文
posted @ 2016-09-22 17:26 D.零下的小书屋 阅读(298) 评论(0) 推荐(0) 编辑
摘要: select *from wsb limit 5;显示前5行 select *from students LIMIT (m,n) +where 筛选条件 select *from wsb where salary>2000; select *from where age is null;(空字段) 阅读全文
posted @ 2016-09-22 16:00 D.零下的小书屋 阅读(944) 评论(0) 推荐(0) 编辑
摘要: update 表名 set 字段=XX where....;(记得加条件不安全改了) 多个字段: update 表名 set 字段1=XX,字段2= where....;(记得加条件不安全改了) 修改多个表的数据: update stu ,score set stu.age=18 ,score.gr 阅读全文
posted @ 2016-09-22 14:47 D.零下的小书屋 阅读(127) 评论(0) 推荐(0) 编辑
摘要: delete from 表名 删除表里的数据 可以配合where试用 阅读全文
posted @ 2016-09-22 14:40 D.零下的小书屋 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 1、指定字段插入数据 insert into wsb2(stu_name,salary)values ('nan','10000'); insert into wsb2(stu_name,salary)values ('nan','10000'),('cc','200');//插入多条 2、不指定字 阅读全文
posted @ 2016-09-22 14:38 D.零下的小书屋 阅读(125) 评论(0) 推荐(0) 编辑
摘要: • 语法: create table 表名(• 列名1 列类型 [<列的完整性约束>],• 列名2 列类型 [<列的完整性约束>],• ... ... ); • PRIMARY KEY 主码约束(主键)• UNIQUE 唯一性约束• NOT NULL 非空值约束• AUTO_INCREMENT用于整 阅读全文
posted @ 2016-09-22 14:13 D.零下的小书屋 阅读(162) 评论(0) 推荐(0) 编辑