getting year from sysdate question
Roger25Apr 2 2009 — edited Apr 2 2009Hello guys,
i have a table SCHOOLMATES, a table SCHOOL_YEAR, and a table SEMESTER. in the 2nd table, i store the school years like 2008-2009, 2009-2010, and so on. for that i used a varchar2 column(also, added check constraint to this).
my first question is that is it recommended to store like this, or is better to have 2 columns, start_year and end_year, both of them being date columns(not varchar). if so, nevermind what i store at day, month parts, i'm interested only in year.
and in big lines, my SEMESTER table looks like:
id int(pk),
school_year_id int references SCHOOL_YEAR(id), -- to know which school year corresponds to a semester
semester int,
start_date date,
end_date date
so i wanna know, the current year and semester for a schoolmate. i think is possible with date manipulation, using also sysdate, but don't know exactly how..
Can you help me please?
Best regards,