Import Data into tables

Important to change your location of the data files in the following script


Run the following commands into psql query window

-- Sectors

\copy sectors (id_sector, sector_name) FROM '/Users/adnanwaheed/desktop/postgresql_queries/stock_markets/stocks_sectors.csv' DELIMITER ',' CSV HEADER;

-- Symbols

\copy symbols (id_symbol, symbol, symbol_name, id_sector, marketcap, employees) FROM '/Users/adnanwaheed/desktop/postgresql_queries/stock_markets/stocks_symbols.csv' DELIMITER ',' NULL as 'NULL' CSV HEADER;

-- prices_latest

\copy prices_latest (id_symbol,trade_date,open_price,high_price,low_price,close_price,volume,chg_1d,return_1d) FROM '/Users/adnanwaheed/desktop/postgresql_queries/stock_markets/stocks_prices_latest.csv' DELIMITER ',' NULL as 'NULL' CSV HEADER;

-- prices_historical

\copy prices_historical (id_symbol,trade_date,open_price,high_price,low_price,close_price,volume,chg_1d,return_1d) FROM '/Users/adnanwaheed/desktop/postgresql_queries/stock_markets/stocks_prices_historical.csv' DELIMITER ',' NULL as 'NULL' CSV HEADER;