composite primary key sql table code example
Example 1: how to define a composite primary key in sql
CREATE TABLE person(id INT,
name TEXT,
PRIMARY KEY (id, name)
);
Example 2: how to define a non primary composite key in sql
ALTER TABLE dbo.YourTable
ADD CONSTRAINT UC_YourTable_Col1_Col2
UNIQUE(Col1, Col2)