Re: time series data - Mailing list pgsql-sql
From | azwa@nc.com.my |
---|---|
Subject | Re: time series data |
Date | |
Msg-id | OF9F6AE314.E3F8364A-ONFFFFFF56.0024DC53@nc.com.my Whole thread Raw |
In response to | time series data (azwa@nc.com.my) |
Responses |
Re: time series data
PgSQL Down |
List | pgsql-sql |
<br /><br /><font face="Courier New" size="2">Hi,</font><br /><br /><font face="Courier New" size="2"> thanks for the info..btwcan u pls explain a little bit detail since i can't get thru yr solution.</font><br /><font face="Courier New" size="2">thanksin advance</font><br /><br /><br /><font face="Courier New" size="2">Dnia 2004-01-21 10:37, Użytkownik TomaszMyrta napisał:<br /><br /> > Use this integer sequence and interval datatype to get date result:<br /> > your_date='1994-01-01'::date+'1day'::integer * time_key<br /> ^^^^^^^<br /> Sorry, use interval here.<br /><br /> Regards,<br /> Tomasz Myrta</font><br /><br /><br /><tablewidth="100%"><tr valign="top"><td></td><td><div align="center"><font face="sans-serif" size="2"><b>azwa@postgresql.org</b></font></div><divalign="center"><br /><font face="sans-serif" size="2">Sent by: pgsql-sql-owner@postgresql.org</font></div><divalign="center"><p><font face="sans-serif" size="2">01/21/2004 04:53 PM</font></div><divalign="center"><br /></div></td><td><font face="sans-serif" size="2"> To: pgsql-sql@postgresql.org</font><br/><font face="sans-serif" size="2"> cc: </font><br /><font face="sans-serif"size="2"> Subject: [SQL] time series data</font></td></tr></table><br /><br /><font face="TimesNew Roman"><br /></font><font face="Times New Roman" size="2"><br /> Hi,</font><font face="Times New Roman"><br/><br /></font><font face="Times New Roman" size="2"><br /> i want to create time table & the structureas below :</font><font face="Times New Roman"><br /></font><font face="Times New Roman" size="2"><br /> </font><font face="Times New Roman"> </font><table border="4"><tr valign="top"><td><font face="sans-serif" size="2">Column</font><fontface="Times New Roman"> </font></td><td><font face="sans-serif" size="2"> Type</font><font face="TimesNew Roman"> </font></td><td><font face="sans-serif" size="2"> Modifiers</font><font face="Times New Roman"> </font></td></tr><trvalign="top"><td><font face="sans-serif" size="2">time_key</font><font face="Times New Roman"> </font><fontface="sans-serif" size="2"><br /> yr_id</font><font face="Times New Roman"> </font><font face="sans-serif" size="2"><br/> month_id</font><font face="Times New Roman"> </font><font face="sans-serif" size="2"><br /> month_desc</font><fontface="Times New Roman"> </font><font face="sans-serif" size="2"><br /> day_id</font><font face="TimesNew Roman"> </font></td><td><font face="sans-serif" size="2"> integer</font><font face="Times New Roman"> </font><fontface="sans-serif" size="2"><br /> integer</font><font face="Times New Roman"> </font><font face="sans-serif"size="2"><br /> integer</font><font face="Times New Roman"> </font><font face="sans-serif" size="2"><br/> text</font><font face="Times New Roman"> </font><font face="sans-serif" size="2"><br /> integer</font><fontface="Times New Roman"> </font></td><td><font face="sans-serif" size="2"> not null default nextval('time_seq'::text)</font></td></tr></table><br/><font face="Times New Roman"><br /><br /></font><font face="TimesNew Roman" size="2"><br /> Example of data in time table:</font><font face="Times New Roman"> </font><table border="4"><trvalign="top"><td><font face="Times New Roman" size="2">Time_key</font><font face="Times New Roman"> </font></td><td><fontface="Times New Roman" size="2"> yr_id</font><font face="Times New Roman"> </font></td><td><font face="TimesNew Roman" size="2"> month_id</font><font face="Times New Roman"> </font></td><td><font face="Times New Roman"size="2"> month_desc</font><font face="Times New Roman"> </font></td><td><font face="Times New Roman" size="2"> day_id</font><fontface="Times New Roman"> </font></td></tr><tr valign="top"><td></td><td><font face="Times New Roman" size="2"> 1999</font><fontface="Times New Roman"> </font></td><td><font face="Times New Roman" size="2"> 1</font><font face="TimesNew Roman"> </font></td><td><font face="Times New Roman" size="2"> Jan</font><font face="Times New Roman"> </font></td><td><fontface="Times New Roman" size="2"> 1</font><font face="Times New Roman"> </font></td></tr><tr valign="top"><td></td><td><fontface="Times New Roman" size="2"> 1999</font><font face="Times New Roman"> </font></td><td><fontface="Times New Roman" size="2"> 1</font><font face="Times New Roman"> </font></td><td><font face="TimesNew Roman" size="2"> Jan</font><font face="Times New Roman"> </font></td><td><font face="Times New Roman" size="2"> 2</font><font face="Times New Roman"> </font></td></tr><tr valign="top"><td></td><td><font face="Times New Roman"size="2"> 2000</font><font face="Times New Roman"> </font></td><td><font face="Times New Roman" size="2"> 1</font><fontface="Times New Roman"> </font></td><td><font face="Times New Roman" size="2"> Jan</font><font face="TimesNew Roman"> </font></td><td><font face="Times New Roman" size="2"> 1</font></td></tr></table><br /><font face="TimesNew Roman"><br /><br /></font><font face="Times New Roman" size="2"><br /> time_key data will keep increment readingfrom sequence. i'm going to have a data from yr_id =1994 --> 2009 , month_id =1 -->12 <br /> and day_id =1 -->31for each month. So is there any solution (using function, or else) that can give me the above data</font><font face="TimesNew Roman"> </font><font face="Times New Roman" size="2"><br /> in Postgresql??. </font><font face="Times NewRoman"><br /></font><font face="Times New Roman" size="2"><br /> thanks in advance.</font><br />