您的位置:首页 > 数据库 > MySQL

以前写的比较实用的mysql代码[2]从txt中读股票数据

2016-02-16 09:27 603 查看
从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%';
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: