liveBook · Manning

Tax identification number

As explained in Build Financial Software with Generative AI (From Scratch)

A tax identification number is an identifier assigned to a company for tax and related administrative purposes.

A tax identification number identifies a company for tax and related administrative purposes. Store it with a tax identification type rather than assuming every organization uses an SSN or EIN. section 10.2.1

A practical company schema treats the identifier as a validated, typed field:

  • Use tax_id_type to distinguish SSN, EIN, ITIN, ATIN, and PTIN. section 10.2.1
  • Use tax_id_number as a required VARCHAR(9) value, with EIN as the default because companies commonly use it. section 10.2.1
  • Enforce expected type values through a database enum, helping prevent erroneous data entry. section 10.2.1
Listing 10.1 Table to store company details
CREATE TABLE company (
    company_id UUID PRIMARY KEY 
                     DEFAULT uuid_generate_v4(),
    name VARCHAR(255) NOT NULL,
    tax_id_type TIN_TYPE NOT NULL DEFAULT 'EIN',  #1
    tax_id_number VARCHAR(9) NOT NULL,
    ach_company_id NUMERIC(10) NOT NULL, #2
    duns NUMERIC(9) DEFAULT NULL,  #3
    logo BYTEA DEFAULT NULL,   #4
    website VARCHAR(255) DEFAULT NULL,
    industry INDUSTRY_TYPE DEFAULT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);

The company table shows the identifier alongside its type, company identity, ACH identifier, and other administrative fields. section 10.2.1

How Build Financial Software with Generative AI (From Scratch) covers it

How deep it goes
Defines identifier types, validation, defaults, and storage length, without detailing format verification or tax-agency procedures.
Examples
Uses SSN, EIN, ITIN, ATIN, and PTIN as identifier types, with a company table defaulting to EIN.
What it assumes
Assumes basic database-schema familiarity while defining tax identifier categories and validation from the schema level.
What you can do after
Configure a company database field that records a required tax number and validates its category through an enum.
How it connects
Connects tax identification numbers to company tables, database enums, data validation, and ACH company identification.

This explainer was generated by Manning's knowledge graph from the text of Build Financial Software with Generative AI (From Scratch). The section links point to the parts of the book it draws on.