從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%';