diff --git a/sql/create.sql b/sql/create.sql index 08d3406..99cffb9 100644 --- a/sql/create.sql +++ b/sql/create.sql @@ -1,11 +1,22 @@ CREATE TABLE option_list ( -seq INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +seq INT NOT NULL AUTO_INCREMENT, CODE VARCHAR(10), DATE DATETIME, fin_price FLOAT, deal_amount INT, deal_cash BIGINT, -comp_bid INT +comp_bid INT, +PRIMARY KEY(seq) +); -) \ No newline at end of file + +drop table if exist futopt_list +create table futopt_list +( + seq int auto_increment, + deal_cash bigint, + date datetime, + fin_price float, + primary key(seq) +); \ No newline at end of file diff --git a/sql/search.sql b/sql/search.sql index b835097..1932154 100644 --- a/sql/search.sql +++ b/sql/search.sql @@ -32,4 +32,19 @@ FROM ON o.date=f.date AND f.deal_cash >= 10000000000) AS sl LEFT OUTER JOIN option_list o2 ON o2.date>=sl.date AND o2.date<=DATE_ADD(sl.date, INTERVAL 30 SECOND) -GROUP BY sl.date \ No newline at end of file +GROUP BY sl.date + + +-- procedure +insert into futopt_list(deal_cash, date, fin_price) + +SELECT f.deal_cash as deal_cash, o.date as date, o.fin_price as fin_price + FROM future_list f LEFT OUTER JOIN option_list o + ON f.deal_cash >= 10000000000 and o.date!=null + + +select * from futopt_list + + +create procedure futopt.FindBigDeal() +BEGIN \ No newline at end of file