Table: Department
Department is a grouping that Staff can be assigned to.
Columns
NameTypeConstraintsDescription
department_KEYintNOT NULLAUTO-INCREMENT: Database assigned primary key for this table.
update__staff_KEYintNOT NULL
update_date_utcdatetimeNOT NULL
department_idnvarchar (11)NOT NULLUser defined identifier (unique).
descriptionnvarchar (250)NOT NULLUser defined description.
create_date_utcdatetimeNOT NULL
department_id_sortablevarchar (48)NOT NULLA representation of the department_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 department_id.
Primary key
NameColumnsDescription
PK_Department$department_KEYdepartment_KEYCLUSTERED
Unique constraints
NameColumnsDescription
UK_Department$department_iddepartment_idEach id must be unique.
UK_Department$department_id_sortabledepartment_id_sortableAn index by the sortable ID is desired, and the algorithm ends up producing unique values.
Incoming foreign keys
NameColumnsReferencing tableDescription
FK_Staff__Department__department_KEYdepartment_KEYStaff
FK_Project_Template__Department__department_KEYdepartment_KEYProject_Template
FK_Project__Department__department_KEYdepartment_KEYProject

Schema diagram