Re: [SQL] database design and diagraming book recommendations..

2000-08-20 Thread David Lloyd-Jones


"Francisco Hernandez" <[EMAIL PROTECTED]>

> anyone know of a good book or books on database modeling?
> like for entity relationship diagrams and such..

 
To get a good life, go with Chris Date's rather difficult two volume set.
 
   -dlj.
 





Re: [SQL] Time Aggregates

2000-08-02 Thread David Lloyd-Jones

"Thomas Lockhart" <[EMAIL PROTECTED]> replied to:
"Itai Zukerman" <[EMAIL PROTECTED]>

> > I'm currently doing this:
> >   SELECT symbol, date_trunc('minute', posted),
> >  min(price), max(price), avg(price)
> >   FROM trade
> >   GROUP BY symbol, date_trunc('minute', posted);
> > to get a list of minute-averages of trade prices.  I get the feeling
> > that this is bad form, that I should be doing this some other way.  Is
> > that the case?
>
> Looks OK to me. If you are doing this *a lot* (i.e. many more queries
> than inserts), then you might want to set up another column which
> contains date_trunc('minute',posted) to avoid the calculation. Something
> like
>
>   create table trade (
> symbol text,
> posted timestamp,
> price integer,
> mpost  timestamp
>   )
>
> then define a rule to update mpost when posted gets set (haven't done
> that part).

Tom,

I want to have two inputs to a table -- 5 widgets at 6 dollars, nextline,7
widgets at 45 dollars, nextline 1 widget at 4...sort of thing -- and output
to screen the $30, $315, $4 with those last three numbers also going back
into the database.

Is there any way of doing this withing the SQL, or does it have to be
written in a scipt external to the database itself?

  Cheers,

 -dlj.








[SQL] Week of the Year?

2000-08-11 Thread David Lloyd-Jones

I'm probably staring right at it. (One of the difficulties with RTFMing, is
having too many docs!)

Is there anything in the API that produces the week of the year, from 1 to
52 or 53 depending on the week of the year, and the days that are in that
week?

Many thanks.

  -dlj.






Re: [SQL] Week of the Year?

2000-08-11 Thread David Lloyd-Jones

Got it: -U with date.

   -dlj.


- Original Message -
From: "David Lloyd-Jones" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 11, 2000 9:27 PM
Subject: [SQL] Week of the Year?


> I'm probably staring right at it. (One of the difficulties with RTFMing,
is
> having too many docs!)
>
> Is there anything in the API that produces the week of the year, from 1 to
> 52 or 53 depending on the week of the year, and the days that are in that
> week?
>
> Many thanks.
>
>   -dlj.
>
>
>
>