From: | Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il> |
---|---|
To: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Timespan conversion |
Date: | 1998-09-27 12:53:53 |
Message-ID: | l03110703b233e2cdd004@[147.233.159.109] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I currently run Postgres 6.2.1.
I wanted to use it to compute my basketball statistics (the classical
relational database application) - enter the rows from the box scores, and
get all sorts of statistics.
My question relates to the 'minutes played' column. The natural
implementation is timespan, because I get times in mm:ss format. Timespans
sum up nicely. The problem begins in calculations such as "average minutes
per game", "minutes between rebounds", etc.
There is no problem in converting timespans to float. I just take the
date_part( 'epoch', timespan_field ), and divide it by, say, 60. My problem
is, after I divide this by the number of games, how do I convert back to
timespan?
Also, is there a way to receive '20:30' or maybe '00:20:30' and not '20
minutes 30 seconds' as a display from timespan? I don't want to build an
application for all this, because, frankly, it's just a hobby. Most of the
work can be done rather well in simplest SQL.
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
From | Date | Subject | |
---|---|---|---|
Next Message | Gemeinschaft Studienarbeit Datenbanken | 1998-09-27 20:46:12 | Another nut to crack with insertion into tables... *sigh* |
Previous Message | Gemeinschaft Studienarbeit Datenbanken | 1998-09-26 15:55:39 | Problems with inserting into tables... |