Click here to Skip to main content
15,919,749 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
Posted
Updated 9-Jun-12 8:27am
v2

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!)
SQL
SELECT 
  id_Applicant, 
  name
FROM
  Applicant
WHERE
  date_of_death IS NOT NULL

:)

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.
 
Share this answer
 
v2
Comments
m_safaaaa 9-Jun-12 14:59pm    
i tried this query but it will give me all applicants who are alive my proble how to fixe the date of 30-05-2012????
Sandeep Mewara 9-Jun-12 15:06pm    
All you need is one more condition to the WHERE clause. Give it a try.
Tim Corey 9-Jun-12 22:27pm    
Teaching a man to fish instead of giving him the fish. I like it. +5
Sandeep Mewara 10-Jun-12 2:18am    
Well, I tried but someone gave away the fish in OP's hand! :doh:
this is the solution:


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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900