sql
2013-11-24 10:00
330 查看
select *
from teacher
where ((ttitle='教授')or(year(getdate())-year(tbirthday))>50 )and tsex='女'
select *
from teacher
where year(tbirthday)>1975 and year(tbirthday)<1980
select *
from teacher
where not(tbirthday between '1975-1-1' and '1980-12-31')
select *
from teacher
where year(tbirthday)!>1975 or year(tbirthday)!<1980
select *
from teacher
where not(year(tbirthday)>1975 and year(tbirthday)<1980)
select *
from student
where classno in ('07010111', '07010211')
select top 11 sname
from student
where(sname not in(select top 9 sname from student))
select sname from student
union
select tname from teacher
select *
from student
where sno like '07%_5'
select *
from student
where sno like '07%5'
select *
from teacher
where tname like '张%' or tname like '李%' or tname like '王%'
select *
from course
where cname='VFP_6.0数据库'
select ttitle 职称,count(*) 人数
from teacher
group by ttitle
/*练习*/
select classno, count(*) 人数
from student
group by classno
select ssex, count(*) 人数
from student
group by ssex
select pno, count(*) 班级数目
from class
group by pno
select deptno, count(*) 专业数目
from professional
group by deptno
select year(sbirthday) 年份, count(*) 学生人数
from student
group by year(sbirthday)
from teacher
where ((ttitle='教授')or(year(getdate())-year(tbirthday))>50 )and tsex='女'
select *
from teacher
where year(tbirthday)>1975 and year(tbirthday)<1980
select *
from teacher
where not(tbirthday between '1975-1-1' and '1980-12-31')
select *
from teacher
where year(tbirthday)!>1975 or year(tbirthday)!<1980
select *
from teacher
where not(year(tbirthday)>1975 and year(tbirthday)<1980)
select *
from student
where classno in ('07010111', '07010211')
select top 11 sname
from student
where(sname not in(select top 9 sname from student))
select sname from student
union
select tname from teacher
select *
from student
where sno like '07%_5'
select *
from student
where sno like '07%5'
select *
from teacher
where tname like '张%' or tname like '李%' or tname like '王%'
select *
from course
where cname='VFP_6.0数据库'
select ttitle 职称,count(*) 人数
from teacher
group by ttitle
/*练习*/
select classno, count(*) 人数
from student
group by classno
select ssex, count(*) 人数
from student
group by ssex
select pno, count(*) 班级数目
from class
group by pno
select deptno, count(*) 专业数目
from professional
group by deptno
select year(sbirthday) 年份, count(*) 学生人数
from student
group by year(sbirthday)
相关文章推荐
- SQL查询语句精华使用简要
- Oracle PL/SQL语言入门基础
- Oracle sql语句优化53个规则详解(三)(www.jiedichina.com)
- SQL技巧:使用SQL子选择来合并查询
- 一条SQL删除所有表中数据
- SQL中条件和比较关键字Case的使用方法(case的结果就是得到了一个值)
- 转:SQL跨域调用远程SP返回的纪录集遇MSDTC分布式异常的处理
- SQL查询重复数据和清除重复数据
- sql 中获取数据库名、表名、存储过程等信息的方法
- SQL优化
- Sql添加Oracle数据库的表空间和用户
- 只有mdf文件的SQL SERVER恢复方法
- SQL基础语句
- 导DIT的SQL
- 查询数据库阻塞锁的SQL
- 【SQL语法】系列04:通配符与like
- System.Data.SqlClient.SqlError: 备份集中的数据库备份与现有的 'XXX' 数据库不同。
- Mysql中批量删除相同表前缀的数据表 sql语句
- SQL的主键和外键约束
- sqlplus 格式化