hist_qry9.sql

Determines the yearly dividends and annual yield (dividends/average closing price) for the past 3 years for all the stocks in the Russell 2000 index that did not split during that period. Uses unadjusted prices, since there were no splits to adjust for.

Output

The first 25 rows returned by this query are:

TRADING_SYMBOL    YEAR        DIVIDEND
AXZ               2005     1.581407226
AYB               2006     1.381549972
AYG               2006     0.367898983
AYI               2006     5.216678323
AYN               2006     4.028782552
AYQ               2006     3450.287281
AYS               2006     3.694855018
AYU               2006     1.271758802
AYW               2006     2.619291171
AZA               2006      2.28069406
AZG               2006     0.990853336
AZH               2006     27.14814009
AZI               2006     1.061584765
AZJ               2005     0.604295833
AZK               2005     22.93923892
AZL               2005     0.902766204
AZN               2006     1.088005743
AZO               2006     1.789226001
AZV               2006     2.247136542
AZZ               2005     0.568150577
BAK               2006     1.266999535
BAL               2005      0.68438775
BAM               2005     0.499661767
BAN               2005      5.72367411
BAR               2006     1.146197323
...

SQL Statements

--Determine the yearly dividends and annual yield (dividends/average closing
--price) for the past 3 years for all the stocks in the Russell 2000 index that
--did not split during that period. Use unadjusted prices since there were no
--stock_split to adjust for.

commit
;

SELECT sh.TRADING_SYMBOL, DATEPART(yy,TRADE_DATE) AS YEAR, 
SUM(dividend_value)/AVG(CLOSE_PRICE) as DIVIDEND
FROM  MARKET_INDEX mi
inner join INDEX_CMPSTN AS ic
on mi.MARKET_INDEX_ID = ic.MARKET_INDEX_ID 
inner join STOCK_HISTORY AS sh
on ic.INSTRUMENT_ID = sh.INSTRUMENT_ID
AND sh.TRADE_DATE BETWEEN '2005-04-04' and '2008-04-03'
inner join DIVIDEND_EVENT de
on de.INSTRUMENT_ID= sh.INSTRUMENT_ID 
AND DATEPART(yy,TRADE_DATE)=DATEPART(yy,ANNOUNCED_DATE) 
AND de.INSTRUMENT_ID NOT IN (SELECT se.INSTRUMENT_ID
FROM   SPLIT_EVENT se
WHERE  sh.INSTRUMENT_ID=se.INSTRUMENT_ID 
AND   DATEPART(yy,TRADE_DATE)=
DATEPART(yy,EFFECTIVE_DATE)) 
WHERE mi.INDEX_NAME ='Russell 2000' 
GROUP  BY sh.TRADING_SYMBOL,
	DATEPART(yy,TRADE_DATE)
order by sh.TRADING_SYMBOL,
	DATEPART(yy,TRADE_DATE)
;