-
Notifications
You must be signed in to change notification settings - Fork 0
/
share_holder_database-queries.txt
50 lines (47 loc) · 1.35 KB
/
share_holder_database-queries.txt
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
39
40
41
42
43
44
45
46
47
48
49
50
create table if not exists share_holder (
holder_id serial unique not null,
holder_name varchar not null,
created_at timestamptz not null default now(),
primary key(holder_name,holder_id)
);
create table if not exists stock (
stock_id serial unique not null,
stock_name varchar not null,
stock_num_share varchar not null,
stock_url varchar not null,
stock_data_url varchar not null,
stock_base_volume varchar not null,
stock_floating float not null,
created_at timestamptz not null default now(),
primary key (stock_name,stock_id)
);
create table if not exists holding (
stock_id int not null,
foreign key (stock_id) references stock(stock_id),
holder_id int not null,
foreign key (holder_id) references share_holder (holder_id),
created_at timestamptz not null default now(),
legal_purchase_volume varchar,
legal_purchase_percent float,
legal_sale_volume varchar,
legal_sale_percent float,
group_pe float,
pe float,
eps int,
closing_price_percent float,
last_price_percent float,
last_price int,
closing_price int,
month_average_volume varchar,
market_value varchar,
transaction_num int,
transaction_value varchar,
transaction_volume varchar,
day_high int,
day_low int,
year_high int,
year_low int,
buy_or_sell_volume int not null,
total_volume int not null,
primary key (stock_id,holder_id,created_at,buy_or_sell_volume,total_volume)
)