CREATE TABLE stock
(
    code        varchar not null,
    name        varchar not null,
    fullname    varchar,
    industry    varchar,
    listed_date date,
    market      varchar,
    exchange    varchar,
    primary key (code)
);


CREATE TABLE daily
(
    code                varchar not null,
    trade_date          date    not null,
    open                double,
    close               double,
    high                double,
    low                 double,
    previous_close      double,
    turnover            double,
    volume              integer,
    price_change_amount double,
    factor              double,
    primary key (code, trade_date)
);

CREATE TABLE finance_indicator
(
    code                                             varchar not null,
    year                                             integer not null,
    accounts_payable                                 double,
    accounts_payable_to_total_assets_ratio           double,
    accounts_receivable                              double,
    accounts_receivable_to_total_assets_ratio        double,
    accounts_receivable_turnover                     double,
    capital_surplus                                  double,
    cash_and_cash_equivalents                        double,
    cash_and_cash_equivalents_to_total_assets_ratio  double,
    cash_flow_adequacy_ratio                         double,
    cash_flow_from_financing_activities              double,
    cash_flow_from_investing_activities              double,
    cash_flow_from_operating_activities              double,
    cash_flow_ratio                                  double,
    cash_reinvestment_ratio                          double,
    current_assets                                   double,
    current_assets_to_total_assets_ratio             double,
    current_liabilities                              double,
    current_liabilities_to_total_assets_ratio        double,
    current_liabilities_to_total_liabilities_ratio   double,
    current_ratio                                    double,
    days_accounts_receivable_turnover                double,
    days_fixed_assets_turnover                       double,
    days_inventory_turnover                          double,
    days_total_assets_turnover                       double,
    earnings_per_share                               double,
    fixed_assets                                     double,
    fixed_assets_to_total_assets_ratio               double,
    fixed_assets_turnover                            double,
    goodwill                                         double,
    goodwill_to_total_assets_ratio                   double,
    inventory                                        double,
    inventory_to_total_assets_ratio                  double,
    inventory_turnover                               double,
    liabilities_to_total_assets_ratio                double,
    long_term_funds_to_fixed_assets_ratio            double,
    long_term_liabilities                            double,
    long_term_liabilities_to_total_assets_ratio      double,
    long_term_liabilities_to_total_liabilities_ratio double,
    net_cash_flow_from_operating_activities          double,
    net_profit                                       double,
    net_profit_margin                                double,
    operating_cost                                   double,
    operating_expenses                               double,
    operating_gross_profit_margin                    double,
    operating_profit                                 double,
    operating_profit_margin                          double,
    operating_revenue                                double,
    operating_safety_margin_ratio                    double,
    quick_ratio                                      double,
    return_on_assets                                 double,
    return_on_equity                                 double,
    shareholders_equity                              double,
    shareholders_equity_to_total_assets_ratio        double,
    surplus_reserve                                  double,
    total_assets                                     double,
    total_assets_turnover                            double,
    total_liabilities                                double,
    total_share_capital                              double,
    undistributed_profit                             double,
    primary key (code, year)
)