以前寫的比較實用的mysql代碼[2]從txt中讀股票數據

從txt中讀股票數據到mysql裏

drop table rc_position;

create table rc_position
(
  account    char(12) not null,
  exchange   smallint not null,
  stockID char(6) not null,
  size       int not null,
  
  primary key(account,exchange,stockID)
);
create table rc_stockInfo
(
stockID char(6) not null,
stockName char(10) not null,
plateName char(10) not null,


    primary key(stockID)
)
select * from rc_stockInfo
delimiter //
drop event if exists e_positiontest;
create event e_positiontest
on schedule every 1 DAY starts
DO
begin
truncate table test.rc_position;
insert into test.rc_position(account,exchange,stockID,size) select * from today.mp_position;
end
//
load data local infile 'X:/jtjz/stock.txt' into table test.rc_stockInfo fields terminated by '\t';


select * from rc_position left join rc_stockinfo on rc_position.stockID=rc_stockinfo.stockID where stockName like '%st%';


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章