摘要: SQL表连接查询(inner join、full join、left join、right join) 前提条件:假设有两个表,一个是学生表,一个是学生成绩表。 表的数据有: 一、内连接-inner jion : 最常见的连接查询可能是这样,查出学生的名字和成绩: select s.name,m.m 阅读全文
posted @ 2016-03-29 16:04 zmztyas 阅读(1275) 评论(0) 推荐(0) 编辑
摘要: SQL在语法显示和执行顺序上并不一致,熟悉其的正确执行顺序,将有助于 理解一些错误的SQL语法的发生原因。以下是其执行顺序列表,优先级按照数字 排序顺序 1、From 2、On 3、Join 4、Where 5、Group By 6、With 7、Having 8、Select 9、Distinct 阅读全文
posted @ 2016-03-29 14:48 zmztyas 阅读(233) 评论(0) 推荐(0) 编辑
摘要: select * from Student;select * from Courseselect ;select* from Teacherselect ;select * from SC;--创建测试数据create table Student(S# varchar(10),Sname nvarc 阅读全文
posted @ 2016-03-29 11:35 zmztyas 阅读(899) 评论(0) 推荐(0) 编辑
摘要: 一:Union指令的目的是将两个sql语句的结果合并起来。 假设我们有以下的两个表格: Store_Information 表: store_name Sales Date Los Angeles $1500 Jan-05-1999 San Diego $250 Jan-07-1999 Los An 阅读全文
posted @ 2016-03-29 11:12 zmztyas 阅读(5814) 评论(0) 推荐(0) 编辑