Re: "order by" days of the week

Поиск
Список
Период
Сортировка
От Roland Roberts
Тема Re: "order by" days of the week
Дата
Msg-id m21y7dljsh.fsf@kuiper.rlent.pnet
обсуждение исходный текст
Ответ на "order by" days of the week  ("D. A." <lameije@yahoo.com>)
Список pgsql-novice
>>>>> "D" == D A <lameije@yahoo.com> writes:

    D> 2)Is there a way to store days of the week that is better than simply
    D> using varchar and performing a check. I read about the time data formats
    D> and they all seem to be more applicable to absolute times rather than
    D> simply a day of the week. I also thought about storing the days as a
    D> number between 1 and 7 then converting for display (1=Monday,
    D> 2=Tuesday...), but that didn't feel clean to me.

The was I've seen this done is to have an extra lookup table where
1=Monday does the translation between the key (the value 1) and the
human-readable version (the value "Monday").  I've not seen it for
this particular case (days of the week), but the idea is quite
general and works fine for this case.

roland
--
               PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                             RL Enterprises
roland@rlenter.com                     76-15 113th Street, Apt 3B
roland@astrofoto.org                       Forest Hills, NY 11375

В списке pgsql-novice по дате отправления:

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: "order by" days of the week
Следующее
От: J Matt Clark
Дата:
Сообщение: virus in download of 7.2.2?