For example, having the tables:
Companies (CompanyID)
Workers (WorkerID, CompanyID)
Users (WorkerID, Username)
With the correct relationships defined, how do I enforce the predication that a User’s Username is unique in the company where its worker is in?
You can use an indexed view for this
There are certain
SEToptions that need to be on for modification of the base tables of indexed views but if you are on SQL Server 2005+ these are on by default.