compound-index

multiple constraint keys

if i have tabled: Resource (id (PK), name) Manager (id(PK), resource_id (FK), manager_resource_ID(FK)) Should resource_id and manager_id both be foreign keys into the Resource table. i obviously dont want to enter any values in each of those columns that are not proper resources when i add the first relationship (resource_id <-> id...

Will SQL Server use a compound index when only a single column is in the WHERE clause?

Say I've got a table: CREATE TABLE Users ( Id INT IDENTITY (1, 1), FirstName VARCHAR(40), LastName VARCHAR(40) ) Queries are usually on FirstName or LastName, but also on FirstName and LastName. If I create a non-clustered index on FirstName and another on LastName, then my first two queries are catered for. Apparently, S...