mercredi 30 septembre 2015

Column vs Table Primary Key constraint in a SQLite table

I'm medling with SQLite databases, and from the documentation :

Each table in SQLite may have at most one PRIMARY KEY. If the keywords PRIMARY KEY are added to a column definition, then the primary key for the table consists of that single column. Or, if a PRIMARY KEY clause is specified as a table-constraint, then the primary key of the table consists of the list of columns specified as part of the PRIMARY KEY clause.

My question is when there's a single column to be used as a PRIMARY KEY, is there a fundamental difference between the two following commands ?

CREATE TABLE t (x INTEGER, y TEXT ,  PRIMARY KEY (x));

CREATE TABLE t (x INTEGER PRIMARY KEY, t TEXT);

Aucun commentaire:

Enregistrer un commentaire