Changes

Jump to navigation Jump to search
no edit summary
\COPY stageflags TO 'flag.txt' WITH DELIMITER AS E'\t' HEADER NULL AS '' CSV;
A sum column was added in excel which is the sum of the last 3 columns. Notice how all entries are 1. This is good.
 
==Checking companybase table==
The following psql code creates a new table called companybase1 that checks for Undisclosed companies and nonUS companies in the companybase table and also inserts a primary key column which is a concatenation of coname, statecode and datefirstinv.
CREATE TABLE companybase1 AS
SELECT *,
concat(coname::text, statecode::text, datefirstinv::text) AS pkey,
CASE
WHEN nationcode = 'US' THEN 1::int
ELSE 0::int
END AS alwaysusflag,
CASE
WHEN coname = 'Undisclosed Company' THEN 1::int
ELSE 0::int
END AS undisclosedflag
FROM companybase;
\COPY companybase1 TO 'companybase1.txt' WITH DELIMITER AS E'\t' HEADER NULL AS '' CSV;

Navigation menu