Table: Bank_Account
Columns
NameTypeConstraintsDescription
bank_account_KEYintNOT NULLAUTO-INCREMENT: Database assigned primary key for this table
update__staff_KEYintNOT NULL
update_date_utcdatetimeNOT NULL
bank_account_idnvarchar (11)NOT NULLUser defined identifier (unique)
descriptionnvarchar (250)NOT NULLUser defined description.
create_date_utcdatetimeNOT NULL
bank_account_id_sortablevarchar (48)NOT NULLA representation of the bank_account_id column that sorts in natural order, meaning that digits are sorted as numbers while non-digits are sorted alphabetically. A trigger keeps this field synchronized with the content of bank_account_id.
Primary key
NameColumnsDescription
PK_Bank_Account$bank_account_KEYbank_account_KEYCLUSTERED
Unique constraints
NameColumnsDescription
UK_Bank_Account$bank_account_idbank_account_idEach id must be unique.
UK_Bank_Account$bank_account_id_sortablebank_account_id_sortableAn index by the sortable ID is desired, and the algorithm ends up producing unique values.
Incoming foreign keys
NameColumnsReferencing tableDescription
FK_Ledger_Entry__Bank_Account__bank_account_KEYbank_account_KEYLedger_Entry
FK_User_Preference__Bank_Account__receipt_entry__bank_account_KEYreceipt_entry__bank_account_KEYUser_Preference
FK_User_Preference__Bank_Account__receipt_entry_adjustment__bank_account_KEYreceipt_entry_adjustment__bank_account_KEYUser_Preference

Schema diagram