6人合力写出来的T-Sql语句
2009-11-05 15:31
260 查看
需求描述:
1.公司有10000人
2.1980年出生的有3000人
3.工资在5000以上的有3000人
4.1980年出生的员工,工资在5000以上的有1000人
查询1980年出生的,工资在5000以上的员工名单
下面是6个同学合力写出来的:
1 --表Employee
2 --出生日期 Birth,类型:datetime
3 --工资 Wage,类型:decimal(18,2)
4 --姓名 EmpName,类型:navarchar(20)
5 --01
6 select EmpName from Employee
7 where Birth = "1980" and Wage = "6000"
8 --02
9 select EmpName from Employee
10 where Birth = "1980" and Wage >5000
11 --03
12 select EmpName from Employee
13 where Birth = '1980' and Wage >5000
14 --04
15 select EmpName from Employee
16 where Birth datetime = '1980' and Wage >50
17 --05
18 select EmpName from Employee
19 where Birth like '1980%' and Wage >5000
20 --06
21 select EmpName from Employee
22 where Birth like '%1980%' and Wage >5000
其实我是希望有人写出这样的语句来:
1 select EmpName from Employee
2 where Year(Birth) = 1980 and Wage >5000
当然不希望有人写出这样的语句来:
1 select EmpName from Employee
2 where Wage >5000 and Year(Birth) = 1980
值得深思!
1.公司有10000人
2.1980年出生的有3000人
3.工资在5000以上的有3000人
4.1980年出生的员工,工资在5000以上的有1000人
查询1980年出生的,工资在5000以上的员工名单
下面是6个同学合力写出来的:
1 --表Employee
2 --出生日期 Birth,类型:datetime
3 --工资 Wage,类型:decimal(18,2)
4 --姓名 EmpName,类型:navarchar(20)
5 --01
6 select EmpName from Employee
7 where Birth = "1980" and Wage = "6000"
8 --02
9 select EmpName from Employee
10 where Birth = "1980" and Wage >5000
11 --03
12 select EmpName from Employee
13 where Birth = '1980' and Wage >5000
14 --04
15 select EmpName from Employee
16 where Birth datetime = '1980' and Wage >50
17 --05
18 select EmpName from Employee
19 where Birth like '1980%' and Wage >5000
20 --06
21 select EmpName from Employee
22 where Birth like '%1980%' and Wage >5000
其实我是希望有人写出这样的语句来:
1 select EmpName from Employee
2 where Year(Birth) = 1980 and Wage >5000
当然不希望有人写出这样的语句来:
1 select EmpName from Employee
2 where Wage >5000 and Year(Birth) = 1980
值得深思!
相关文章推荐
- 队伍分组统计 (双重循环遍历出来)或 (sql语句查出来
- sql语句里有中文字符,JDBC查询不出来结果
- ListUI中增加了分录的字段后,query中的sql语句显示出来的是按照顺序显示出来的,而ListUI中显示出来的数据确实乱的
- hibernate session.get() 和用sql语句取出来的po进行update
- SQL语句查询:把数据库中的表(表名)列出来
- 如何在sql/plus中把select语句查询显示出来的结果中的显示字段长度缩小
- SQL语句:两个时间区间段,只要有交集,就能筛选出来
- 很强的Sql语句测试题,能独立做出来你的Sql就出师了
- MySql update inner join!MySql跨表更新 多表update sql语句?如何将select出来的部分数据update到另一个表里面?
- MySql update inner join!MySql跨表更新 多表update sql语句?如何将select出来的部分数据update到另一个表里面?
- SQL语句 怎么把从一个表中查出来数据插入到另一个表中
- 同样的sql语句在数据库中能查出结果,但是在java项目中,查不出来
- 通过sql语句将blob里的char取出来转成数字保存在其它字段
- SQL语句,将select 出来的两列信息,合并成一列显示
- MySql update inner join!MySql跨表更新 多表update sql语句?如何将select出来的部分数据update到另一个表里面?
- select t.* , t.rowid from-对查询出来的sql语句进行编辑
- 一条sql语句分别统计出来两张表的数据
- 为什么在tpshop中用getlastsql 打印不出来sql语句,
- 通过sql语句将blob里的char取出来转成数字保存在其它字段
- 通过sql语句查询出来的结果字段没有到对应实体类时的处理方法