Re: To get a Table or View like a Calendar with dates
От | Kevin Grittner |
---|---|
Тема | Re: To get a Table or View like a Calendar with dates |
Дата | |
Msg-id | 502BC9860200002500049768@gw.wicourts.gov обсуждение исходный текст |
Ответ на | Re: To get a Table or View like a Calendar with dates (Csanyi Pal <csanyipal@gmail.com>) |
Список | pgsql-novice |
Csanyi Pal <csanyipal@gmail.com> wrote: > The first table contains the ordinal number of the semester (1 or > 2) and the start dates of the same: > > iskolanaptar_201213=# select * from felevek_kezdetei_1_8; > felev1v2 | datum > ----------+------------ > 1 | 2012-09-03 > 2 | 2013-01-15 > (2 rows) > > The second table contains the end date of the first semester and > the number of the days in this semester: > > iskolanaptar_201213=# select * from felev1_vege_tan_nap_1_8; > datum | ennyi_tan_nap > ------------+--------------- > 2012-12-21 | 78 > (1 row) I think you need to rethink the table structure. It's not immediately obvious why you wouldn't include the date of the end of the semester in the same table as the start date for the semester and the semester identifying information. You might want to read up on data normalization for relational databases. The usual way of organizing something like semester information would be to have a table with the columns which identify a semester (perhaps school year and semester number) and all the data elements which require both of those elements, and only those elements, to determine the correct value. That would probably include start date and end date for the semester. (Or if you can start development with 9.2 beta at this point, it might be even better to use a date range instead of the two dates.) You'll be in much better shape if you organize your data that way. If you review the literature, you want to shoot for "3rd normal form" -- below that level things tend to be pretty messy; above that can get pretty esoteric. -Kevin
В списке pgsql-novice по дате отправления: