Commit f31d5a9b authored by Vishwesh Patel's avatar Vishwesh Patel
Browse files

ipo and comment tables to sql

parent 6a1f609f
......@@ -161,7 +161,53 @@ add foreign key (symbol) references Stock(symbol);
/********************************************************************************************/
/* LOAD IPO DATA */
/* TODO once new csv is created */
/* create IPODetails Temp table to store raw date values */
create table IPODetailsTemp (
symbol varchar(6),
year int,
month int,
day int,
daysGreen int,
daysBetterThanSP int,
marketMonthTrend float,
market3MonthTrend float,
market6MonthTrend float,
marketYearTrend float,
usaCompany varchar(7)
);
/* create Final IPODetails table */
create table IPODetails (
symbol varchar(6),
day datetime,
daysBetterThanSP int,
daysGreen int,
marketMonthTrend float,
market3MonthTrend float,
market6MonthTrend float,
marketYearTrend float,
usaCompany varchar(7),
primary key (symbol, day),
foreign key (symbol) references Stock(symbol)
);
/* Load raw data into temp table */
load data infile '/var/lib/mysql-files/Group41/IPODataFull_processed_G41.csv' ignore into table IPODetailsTemp
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
ignore 1 lines;
/* calculate date-time field and tranfer data to final table */
insert into IPODetails(symbol, day, daysBetterThanSP, daysGreen, marketMonthTrend, market3MonthTrend, market6MonthTrend, marketYearTrend, usaCompany)
select symbol, cast(cast(year as string) + '-' + cast(month as string) + '-' + cast(day as string) as datetime), daysBetterThanSP, daysGreen, marketMonthTrend, market3MonthTrend, market6MonthTrend, marketYearTrend, usaCompany
from IPODetailsTemp;
drop table if exists IPODetailsTemp;
/********************************************************************************************/
/********************************************************************************************/
......@@ -276,5 +322,18 @@ drop table ArticleTemp;
/********************************************************************************************/
/********************************************************************************************/
/* CREATE STOCK COMMENT */
/* create StockCommnet table */
create table StockComment (
symbol varchar(6),
date datetime,
text text,
primary key (symbol, date),
foreign key (symbol) references Stock(symbol)
);
/* no need to load as client will add data */
/********************************************************************************************/
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment