I was reading a brilliant response provided by PerformanceDBA to this SQL Question.
In PerformanceDBA 'Full Example', tables 'user' and 'sport' show two PRIMARY KEY s per table. Note; should you look carefully at PerformanceDBA response, you will notice Primary Key One consists of one single field, while Primary Key Two consists of three fields; a composite Key.
Given Microsoft T-SQL Server does not support more than one Primary Key per table (I was unaware that SQL ANSI did either), how would we achieve the concept presented by PerformanceDBA as a workable Microsoft T-SQL solution (ie, following Microsoft T-SQL syntax)?
Is there a chance the information provided by PerformanceDBA simply includes a typo; an error which he overlooked?
My initial thoughts are (table definition from PerformanceDBA answer to SQL Question with minor modification to suit T-SQL):
CREATE TABLE [User] ( -- Typical Identifying Table
[user_name] CHAR(16) NOT NULL, -- Short PK
name_first CHAR(30) NOT NULL, -- Alt Key.1
name_last CHAR(30) NOT NULL, -- Alt Key.2
birth_date DATE NOT NULL , -- Alt Key.3
--Create a unique CONSTRAINT and assign a Foreign Key (
CONSTRAINT User_PK PRIMARY KEY ( [user_name] ),
-- Will this 'do'?
CONSTRAINT User_AK UNIQUE ( name_last, name_first, birth_date ),
CONSTRAINT user_FK -- unique person identification
FOREIGN KEY (name_last, name_first, birth_date)
REFERENCES [Person] ( name_last, name_first, birth_date)
)
Thank you for your time.