Database Reference
In-Depth Information
The result is:
Indeed, there does seem to be a difference according to the day of the week. The NASDAQ
100 appears to go down on Monday and Tuesday and then go up on the other three days of the
week. Thursday, in particular, seems to be a good day to trade long.
But, you begin to wonder, is this pattern true for each year? To answer that question, you
use the query:
/* *** SQL-Query-NDX-CH02-05 *** */
SELECT TDayOfWeek, TYear, AVG(ChangeClose) AS AvgChange
FROM NDX
GROUP BY TDayOfWeek, TYear
ORDER BY TDayOfWeek, TYear DESC;
Because there are 20 years of data, this query results in 100 rows, of which the first 12 are
shown in the following results:
To simplify your analysis, you decide to restrict the number of rows to the most recent 5
years (2000-2004):
/* *** SQL-Query-NDX-CH02-06 *** */
SELECT TDayOfWeek, TYear, AVG(ChangeClose) AS AvgChange
FROM NDX
WHERE TYear > '1999'
GROUP BY TDayOfWeek, TYear
ORDER BY TDayOfWeek, TYear DESC;
 
Search WWH ::




Custom Search