-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcreateDatabase.sql
More file actions
38 lines (35 loc) · 915 Bytes
/
Copy pathcreateDatabase.sql
File metadata and controls
38 lines (35 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- You need manually create schema StocksDataBase in PgAdmin;
-- comment lines must starts with "--" and ends with semicolon, otherwise you will get an error;
-- company table with various data;
drop table if exists company;
CREATE TABLE company (
ticker VARCHAR(20) PRIMARY KEY,
name VARCHAR(100),
ranking smallint,
mkt_cap smallint,
pe_ratio float,
eps float,
dividend_pct float,
exchange VARCHAR(20),
esg_score smallint,
recom_rating float,
sector VARCHAR(50),
industry VARCHAR(50),
country VARCHAR(100),
city VARCHAR(100),
latitude float,
longitude float
);
-- historical price data downloaded from finance.yahoo.com;
drop table if exists price;
CREATE TABLE price (
ticker VARCHAR(20),
date date,
open float,
high float,
low float,
close float,
adj_close float,
volume bigint,
PRIMARY KEY (ticker, date)
);