99  SQL Constraints

99.1 Primary key

99.2 Foreign Key

99.3 Unique

UserId PK Email –

Person PersonKey int TcIdentityNo string unique

99.4 Not null

99.5 Default value

created_at default datetime(‘now’)

99.6 Check (Custom constraints)

Appointments StartDateTime EndDateTime check(EndDateTime > StartDateTime), check(StartDateTime > datetime(‘now’)),

TcIdentityNo, custom function to checksum number Name, custom function to check no punctuation and numbers

Invoice Total check(total > 0)