Output  tick_qry2.sql

Appendix A: SQL Scripts for Sample Queries

SQL

The following script contains the SQL statements for this query. Note that there are separate scripts optimized for the RAP cache and the RAP repository.

RAP repository

-- Get all ticks for a specified set of 100 securities for a specified
-- three hour time period on a specified trade date.
-- This query is optimized to run IQ.

commit;

SELECT TRADING_SYMBOL, TRADE_DATE, TRADE_TIME, TRADE_PRICE
FROM  STOCK_TRADE
WHERE TRADE_TIME BETWEEN '2005-11-14 9:00'
	AND '2005-11-14 12:00'
	AND TRADING_SYMBOL BETWEEN 'AAA' AND 'ADV'
	AND LENGTH(TRADING_SYMBOL) = 3
;

RAP cache

-- Get all ticks for a specified set of 100 securities for a specified
-- three hour time period on a specified trade date.

-- This query is optimized to run ASE.


SELECT TRADING_SYMBOL, TRADE_DATE, TRADE_TIME, TRADE_PRICE
FROM  STOCK_TRADE 
WHERE TRADE_TIME BETWEEN '2005-11-14 9:00:00'
	AND '2005-11-14 12:00:00'
	AND TRADING_SYMBOL BETWEEN 'AAA' AND 'ADV'
	AND LEN(TRADING_SYMBOL) = 3

go




Copyright © 2005. Sybase Inc. All rights reserved. tick_qry2.sql

View this book as PDF