Recommended Schema:
Person
Column Type Notes
Person_ID Primary Key Unique identifier for each person
Name String Name of the person
Company_ID Foreign Key References Company.Company_ID
Phone String Phone number
Email String Email address
Company
Column Type Notes
Company_ID Primary Key Unique identifier for each company
Name String Name of the company
Address String Address of the company
City String City of the company
State String State of the company
Invoice_ID Foreign Key Unique Reference to Invoice.Invoice_ID (1-to-1 relationship)
Invoice
Column Type Notes
Invoice_ID Primary Key Unique identifier for each invoice
Summary_ID Foreign Key References Summary_Section.Summary_ID
Detailed_ID Foreign Key References Detailed_Section.Detailed_ID
Summary_Section
Column Type Notes
Summary_ID Primary Key Unique identifier for the summary
InvoiceNumber String Invoice number
Date Date Invoice date
DueDate Date Invoice due date
Detailed_Section
Column Type Notes
Detailed_ID Primary Key Unique identifier for the detailed section
Person_ID Foreign Key References Person.Person_ID
Amount Decimal Amount related to the person
Info String Additional information
InvoiceNumber String Invoice number
Date Date Invoice date
DueDate Date Invoice due date
Key Adjustments:
Relationship Diagram Here’s how the relationships look conceptually: • Company (1-to-1) → Invoice • Invoice (1-to-1) → Summary_Section • Invoice (1-to-many) → Detailed_Section • Company (1-to-many) → Person • Person (1-to-many) → Detailed_Section
SQL Example Here’s an example of creating tables with these relationships: sql CopyEdit CREATE TABLE Company ( Company_ID INT PRIMARY KEY, Name NVARCHAR(100), Address NVARCHAR(255), City NVARCHAR(100), State NVARCHAR(50), Invoice_ID INT UNIQUE, FOREIGN KEY (Invoice_ID) REFERENCES Invoice(Invoice_ID) );
CREATE TABLE Person ( Person_ID INT PRIMARY KEY, Name NVARCHAR(100), Company_ID INT, Phone NVARCHAR(15), Email NVARCHAR(100), FOREIGN KEY (Company_ID) REFERENCES Company(Company_ID) );
CREATE TABLE Invoice ( Invoice_ID INT PRIMARY KEY, Summary_ID INT UNIQUE, Detailed_ID INT UNIQUE, FOREIGN KEY (Summary_ID) REFERENCES Summary_Section(Summary_ID), FOREIGN KEY (Detailed_ID) REFERENCES Detailed_Section(Detailed_ID) );
CREATE TABLE Summary_Section ( Summary_ID INT PRIMARY KEY, InvoiceNumber NVARCHAR(50), Date DATE, DueDate DATE );
CREATE TABLE Detailed_Section ( Detailed_ID INT PRIMARY KEY, Person_ID INT, Amount DECIMAL(10, 2), Info NVARCHAR(255), FOREIGN KEY (Person_ID) REFERENCES Person(Person_ID) );
Next Steps: