T-SQL高级查询语句 高级查询 1.连接查询,对结果集列的扩展 select * from info select * from info,nation #形成笛卡尔积 select * from info,nation where info.nation=nation.code select info.code,info.name,sex,nation.name,birthday from info,nation where info.nation=nation.code select *…
高级查询: 一:多表连接 1.select Info.Code,Info.Name,Nation.Name from Info,Nation where Info.Nation = Nation.Code 查几张表就就输出几张表,查那个条件就输出那个条件 列的查询 select * from Info,Nation 全部输出4x4 2.join连接 select * from Info join Nation on Info.Nation = Nation.Code 筛选输出数据 二:多表联合…
高级查询 1.连接查询,对结果集列的扩展select * from info select * from info,nation #形成笛卡尔积select * from info,nation where info.nation=nation.codeselect info.code,info.name,sex,nation.name,birthday from info,nation where info.nation=nation.code select * from info join…
--select select * from student; --all 查询所有 select all sex from student; --distinct 过滤重复 select distinct sex from student; --count 统计 select count(*) from student; select count(sex) from student; select count(distinct sex) from student; --top 取前N条记录 s…
MySQL高级SQL语句 目录 MySQL高级SQL语句 创建两个表 SELECT DISTINCT WHERE AND OR IN BETWEEN 通配符 LIKE ORDER BY 函数 数学函数 聚合函数 字符串函数 GROUP BY HAVING 别名 子查询 EXISTS 表连接的方式 表的自我连接 CREATE VIEW UNION 交集值 无交集值 CASE 空值 正则表达式 存储过程 存储过程的优点: 创建存储过程 查看存储过程 存储过程的参数 删除存储过程 存储过程的控制语句…