Display the student name, date of birth and their zodiac sign. Use Zodiac as alias
a. Aries Mar 21-Apr 19
b. TaurusApr 20 –May 20
c. GeminiMay 21-Jun 20
d. Cancer Jun21- Jul22
e. Leo Jul 23- Aug 22
f. Virgo Aug 23-Sept 22
g. Libra Sept 23-Oct 22
h. Scorpio Oct 23- Nov 21
i. Sagittarius Nov 22-Dec 21
j. Capricorn Dec 22- Jan 19
k. Aquarius Jan 20 – Feb 18
l. Pisces Feb 19- Mar 20
The code I wrote was:
select sname, sdob, case
when sdob between (select date('____-03-21')) and (select date('____-04-19')) then 'Aries'
when sdob between '%-04-20' and '%-05-20' then 'Tarus'
when sdob between '%-05-21' and '%-06-20' then 'Gemini'
when sdob between '%-06-21' and '%-07-19' then 'Cancer'
when sdob between '%-07-21' and '%-08-19' then 'Leo'
when sdob between '%-08-21' and '%-09-19' then 'Virgo'
when sdob between '%-09-21' and '%-10-19' then 'Libra'
when sdob between ( sdob like'%-10-21') and ( sdob like'%-11-19') then 'Scropio'
when sdob between ( sdob like'%-11-21') and ( sdob like'%-12-19') then 'Sagittarious'
when sdob between ( sdob like'%-12-21') and ( sdob like'%-01-19') then 'Capricon'
when sdob between '____-01-21' and '____-02-19' then 'Aquarius'
when sdob between '%-02-21' and '%-03-19' then 'Pisces'
end 'SunSign'
from student;
But it shows all null values in the SunSign field on the output.