困难的查询,请紧急 [英] Difficult query please it's urgent

查看:109
本文介绍了困难的查询,请紧急的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个名为申请人"的表,该表具有以下字段:

``id_Applicant'',``name'',``date_of_birth'',``date_of_death''

sql或oracle查询为:

''选择所有在2012年5月30日还活着的申请人''

请紧迫

非常感谢.

hello,

I have a table named ''Applicant'' having fields:

''id_Applicant'', ''name,''date_of_birth'',''date_of_death''

the sql or oracle query is:

''Select all applicant who are alive on 30-05-2012''

Please it''s urgent

thanks alot.

推荐答案

您是否尝试过一次?

好吧,首先,采用一种逻辑方法(直到有人死后,死亡日期才会被填满,并且它将为空.一旦死亡,那么那里只有数据!)
Did you even tried once?

Well, to start with, a logical way (date of death will not be filled and will be null until unless someone dies. Once dead, then only data is there!)
SELECT 
  id_Applicant, 
  name
FROM
  Applicant
WHERE
  date_of_death IS NOT NULL


:)

现在,如果您需要根据某些情况在查询中使用当前日期,请自己尝试.您几乎可以查询90%的内容.


:)

Now, if you need to use current date in your query based on some scenario, try by yourself. You almost have 90% of query with you.


这是解决方案:


this is the solution:


SELECT
  id_Applicant,
  name
FROM
  Applicant
WHERE
  date_of_death is NULL or date_of_death > 30-5-2012  


这篇关于困难的查询,请紧急的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆