Hi folks,
I have a table in this format (similar to the class schedule you had in college):
create table match_times
(
match_time varchar2(20 char),
match_sun_day char(1 char),
match_mon_day char(1 char),
match_tue_day char(1 char),
match_wed_day char(1 char),
match_thu_day char(1 char),
match_fri_day char(1 char),
match_sat_day char(1 char)
)
comment on column match_times.match_time is 'E.g. ''08:00-08:50''';
comment on column match_times.match_sun_day is '''U'' or null';
comment on column match_times.match_mon_day is '''M'' or null';
comment on column match_times.match_tue_day is '''T'' or null';
comment on column match_times.match_wed_day is '''W'' or null';
comment on column match_times.match_thu_day is '''R'' or null';
comment on column match_times.match_fri_day is '''F'' or null';
comment on column match_times.match_sat_day is '''S'' or null';
I want to write a query that will get me for e.g.:
8:00 - 9:00 MTF
9:00 - 10:15 TR
This can be done easily using a function, but I'm curious if this can be done by using an SQL query. This isn't important, it's just for knowledge:)
EDIT: Sorry, I missed out one vital clarification. There can be multiple rows per match time. It could have MF on one row and W on the next. Now I understand why you folks were asking for the actual create table statement.