Primary key from multiple columns

CREATE TABLE world (
    country TEXT NOT NULL,
    state TEXT NOT NULL,
    city TEXT NOT NULL,
    population INTEGER NOT NULL,
    PRIMARY KEY (country_id, state_id, city_id)
);
  • All columns require a value when inserting.
  • Two rows cannot have the same country_id, state_id, city_id combination.
  • Two or more rows can have the same values in two columns, with a different value in the third column.