Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Question

Re: SQL Question

From: <fitzjarrell_at_cox.net>
Date: Tue, 25 Sep 2007 05:51:32 -0700
Message-ID: <1190724692.892354.101700@57g2000hsv.googlegroups.com>


On Sep 24, 4:40 pm, stevenleong..._at_gmail.com wrote:
> I have given the following question. I need help on this.
>
> Given a schema for a stock trades table that looks like:
>
> *stocktrades (*
> * symbol string, -- stock symbol*
> * shares integer, -- number of shares traded*
> * price float, -- price of the stock for this trade*
> * timestamp integer -- timestamp in hhmmss 24-hour format*
> * -- i.e., 000000 = midnight, 235959 = 11:59.59
> PM*
> *)*
>
> Assuming the above table holds data for exactly one day of
> information
> (midnight to 11:59.59 PM), write the query needed to summarize the
> stock trades data into the following table that holds weighted
> average
> price for each stock for every hourly period during that day:
>
> *avgtrades (*
> * symbol string, -- stock symbol*
> * period integer, -- a one or two digit value representing*
> * -- the hourly period of the trades*
> * -- (0 = 000000-005959, 1 = 010000 -
> 015959...)*
> * avgprice float -- weighted average price is the sum of*
> * -- total dollars (price*shares) / total*
> * -- number of shares traded in any interval*

And what have you done to solve this problem? No one will sit and do your homework for you, however we will assist once you have proven you've at least tried to wite this query on your own. Also, you do not specify which DBMS your instructor has decided to use; if it is Oracle you've come to the right group.

Post the work you have done thus far. Don't expect much in the way of assistance until you do.

David Fitzjarrell Received on Tue Sep 25 2007 - 07:51:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US