一.SQL子查询语句 1.单行子查询 select ename,deptno,sal from emp where deptno=(select deptno from dept where loc='NEW YORK'): 2.多行子查询 SELECT ename,job,sal FROM EMP WHERE deptno in ( SELECT deptno FROM dept WHERE dnam…
查询数据 简单的查询 create table stu_info ( sno int not null ,sname ) not null ,sex ) not null ,birth ) not null ,email ) not null ,telephone int not null ,depart ) not null ) select distinct depart from dbo.stu_info -- select order by depart from dbo.stu_inf…
SQL Server T-SQL高级查询 高级查询在数据库中用得是最频繁的,也是应用最广泛的. Ø 基本常用查询 --select select * from student; //查询student表中所有字段. --all 查询所有 select all sex from student; --distinct 过滤重复 select distinct sex from student; --count 统计 select count(*) from student; selec…