Again, scenario of a schema for which I needed to design the whole schema?
Design a normalized relational schema for accounts, customers, account ownership, and account transactions, then write a query that validates the design by producing an account-level balance report. Include accounts without transactions and preserve accounts with no recorded owner.
account_id, account_type, owner_names, balance, latest_transaction_date, and account_type_rank.account_type, descending balance, then account_id.| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Unique account identifier |
| account_type | VARCHAR(20) | Account classification |
| opened_date | DATE | Date the account was opened |
| status | VARCHAR(20) | Current account status |
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer's full name |
| customer_status | VARCHAR(20) | Current customer status |
| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Referenced account |
| customer_idPK | INT | Referenced customer |
| holder_role | VARCHAR(20) | Customer's ownership role |
| added_date | DATE | Date the customer was added |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| account_id | INT | Referenced account |
| transaction_type | VARCHAR(20) | Credit, debit, or disbursement |
| amount | NUMERIC(14,2) | Nonnegative transaction amount |
| transaction_date | DATE | Date of the transaction |
| description | VARCHAR(100) | Optional transaction description |