Sqlite primary key on multiple columns

Bogdan Gavril MSFT picture Bogdan Gavril MSFT · Apr 9, 2009 · Viewed 274.8k times · Source

What is the syntax for specifying a primary key on more than 1 column in SQLITE ?

Answer

Brian Campbell picture Brian Campbell · Apr 9, 2009

According to the documentation, it's

CREATE TABLE something (
  column1, 
  column2, 
  column3, 
  PRIMARY KEY (column1, column2)
);