==Building companybase and round==
Both are built from roundbasewhich contains portfolio companies and round details. The scripts are below.
CREATE TABLE companybase AS
SELECT DISTINCT
FROM roundbase
ORDER BY coname;
==Building stageflags==
Stageflags are built from the stage3 column of round. Using the tables above, I made 6 flags for seed, early, later, growth, transaction and exclude. The script is below. Verify that no row entries are missing flags in excel by copying the round table to a txt file. The last 3 columns should always sum to 1 for every row entry. There should be no zero sums and no sums greater than 1.
CREATE TABLE stageflags AS
SELECT coname, stage3,
CASE
WHEN stage3 = 'Seed' THEN 1
ELSE 0
END AS seedflag,
CASE
WHEN stage3 = 'Early Stage' THEN 1
ELSE 0
END AS earlyflag,
CASE
WHEN stage3 = 'Later Stage' THEN 1
ELSE 0
END AS laterflag,
CASE
WHEN stage3 = 'Seed' OR stage3 = 'Later Stage' OR stage3 = 'Early Stage' THEN 1
ELSE 0
END AS growthflag,
CASE
WHEN stage3 = 'Acq. for Expansion' OR stage3 = 'Acquisition' OR stage3 = 'Bridge Loan' OR stage3 = 'Expansion' OR stage3 = 'Pending Acq' OR stage3 = 'Recap or Turnaround' OR stage3 = 'Mezzanine' THEN 1
ELSE 0
END AS transactionflag,
CASE
WHEN stage3 = 'LBO' OR stage3 = 'MBO' OR stage3 = 'Open Market Purchase' OR stage3 = 'PIPE' OR stage3 = 'Secondary Buyout'
OR stage3 = 'Other' OR stage3 = 'VC Partnership' OR stage3 = 'Secondary Purchase' THEN 1
ELSE 0
END AS excludeflag
FROM round;