diff --git a/.gitignore b/.gitignore index 08dd4de..4d56f9a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ sec_data/ CIK* .vscode -stockdb.session.sql \ No newline at end of file +stockdb.session.sql +temp.json \ No newline at end of file diff --git a/db_schema.sql b/db_schema.sql index 1360668..24055e4 100644 --- a/db_schema.sql +++ b/db_schema.sql @@ -12,14 +12,14 @@ CREATE TABLE sub ( zipba VARCHAR(10), -- Zip code of business address bas1 VARCHAR(40), -- First line of business address bas2 VARCHAR(40), -- Second line of business address - baph VARCHAR(12), -- Phone number of business address + baph VARCHAR(20), -- Phone number of business address countryma CHAR(2), -- Country of mailing address (ISO 3166-1) stprma CHAR(2), -- State/Province of mailing address (if applicable) cityma VARCHAR(30), -- City of mailing address zipma VARCHAR(10), -- Zip code of mailing address mas1 VARCHAR(40), -- First line of mailing address mas2 VARCHAR(40), -- Second line of mailing address - countryinc CHAR(3) NOT NULL, -- Country of incorporation + countryinc CHAR(3), -- Country of incorporation stprinc CHAR(2), -- State/Province of incorporation (if applicable) ein CHAR(10), -- Employer Identification Number former VARCHAR(150), -- Most recent former name @@ -47,10 +47,10 @@ CREATE TABLE tag ( custom BOOLEAN NOT NULL, -- 1 if custom tag, 0 if standard tag abstract BOOLEAN NOT NULL, -- 1 if abstract (not numeric), 0 if numeric datatype VARCHAR(20), -- Data type (if numeric) - iord CHAR(1) NOT NULL, -- "I" for point-in-time, "D" for duration + iord CHAR(1), -- "I" for point-in-time, "D" for duration crdr CHAR(1), -- Credit/ Debit nature, if monetary tlabel VARCHAR(512), -- Label text - doc VARCHAR(2048), -- Tag definition/documentation + doc LONGTEXT, -- Tag definition/documentation PRIMARY KEY (tag, version) ); @@ -60,14 +60,14 @@ CREATE TABLE num ( adsh CHAR(20) NOT NULL, -- Accession number tag VARCHAR(256) NOT NULL, -- Tag name version CHAR(20) NOT NULL, -- Taxonomy version - coreg VARCHAR(256), -- Coregistrant ID + coreg VARCHAR(256) NOT NULL, -- Coregistrant ID ddate CHAR(8) NOT NULL, -- Period end date (format: yyyymmdd) qtrs INTEGER NOT NULL, -- Number of quarters (0 for point-in-time values) uom VARCHAR(20) NOT NULL, -- Unit of Measure value NUMERIC(28,4), -- Value (up to 4 decimal places) footnote VARCHAR(512), -- Footnote (superscripted text) - PRIMARY KEY (adsh, tag, version, ddate, qtrs, uom, coreg), + PRIMARY KEY (adsh, tag, version, coreg, ddate, qtrs, uom), FOREIGN KEY (adsh) REFERENCES sub(adsh), FOREIGN KEY (tag, version) REFERENCES tag(tag, version) ); @@ -98,4 +98,14 @@ DROP TABLE IF EXISTS pre; DROP TABLE IF EXISTS sub; DROP TABLE IF EXISTS tag; SET FOREIGN_KEY_CHECKS = 1; --- @end \ No newline at end of file +-- @end\ + + +-- baph is 12 in new 20 in old +-- doc is 2048 in new unlimitted in old + +-- countrinc was set as cant be null, but there are some null values +-- iord was set as cant be null, but there are some null values + +-- there is a duplicated primary key in 2009q3tagline5014 +-- there is a duplicated primary key in 2009q3tagline9980 its not the same case but same string so causes problem \ No newline at end of file