摘要: 将两个select语句的查询结果通过并运算(union)合并成一个查询结果。进行合并查询时,要求两个查询结果具有相同的字段数,并且对应字段的数据类型也必须相同如:查询1985以前及1989后的学生信息select 学号,姓名 from 学生表 where year 1989 阅读全文
posted @ 2013-05-30 02:22 好记性还真不如烂笔头 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 多表查询两种格式:1 。join on2.wherea.inner join .. on包括两个表都有的记录select t1.cols1,t1.cols2,t2.cols1,t2.cols2from t1inner join t2on t1.cols1=t2.cols1其中:(t1 inner j... 阅读全文
posted @ 2013-05-30 02:04 好记性还真不如烂笔头 阅读(205) 评论(0) 推荐(0) 编辑
摘要: group by [having ]1.统计各班人数:select 班级编号,count(*) as total from 学生表 group by 班级编号2.统计各职称教师人数:select 职称,count(*) as totalfrom 教师表group by 职称order by 职称3... 阅读全文
posted @ 2013-05-30 01:28 好记性还真不如烂笔头 阅读(408) 评论(0) 推荐(0) 编辑