What does keyword CONSTRAINT do in this CREATE TABLE statement

后端 未结 2 1477
攒了一身酷
攒了一身酷 2021-02-06 02:41

I\'m learning how to use sqlite3 with python. The example in the text book I am following is a database where each Country record has a Region, Country, and Population.

2条回答
  •  抹茶落季
    2021-02-06 03:11

    If you omit CONSTRAINT Contry_Key from the statement, SQL server will generate a name for your PRIMARY KEY constraint for you (the PRIMARY KEY is a type of constraint).

    By specifically putting CONSTRAINT in the query you are essentially specifying a name for your primary key constraint.

提交回复
热议问题