Re: SQL Question



stevenleongusa@xxxxxxxxx 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*

This is what is called homework. That means you, the student, are
supposed to go home and learn by investing effort into it. Answering
the question you are asking would undermine your efforts and would
be unfair to you, unfair to your instructor, unfair to your fellow
students, and unfair to any prospective employer duped into believing
you were qualified.

If you want help ... post your work so far. You will receive hints
not answers.

And for those in the forum not in tune with the change in the seasons.
School has just started at most colleges and universities or will in
the next week or two. Please do not help them with anything other than
hints.

Thank you.
--
Daniel A. Morgan
University of Washington
damorgan@xxxxxxxxxxxxxxxx (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
.