Oracle constraints and index constraints www.2cto.com constraints include: not null, unique, primary key, foreign key, check not null (non-null). If not null is defined on the column, when inserting data, you must provide the data unique (unique) for the column. When a unique constraint is defined, the value of this column cannot be repeated, but it can be a nullprimary key (primary key) it is used to uniquely represent the data of rows in the table. When the primary key constraint is defined, this column cannot be repeated and cannot be null. note: A table can have only one primary key at most, but multiple unqiue constraints are allowed. ========================================================== ==================== Index ------------------------------------------------------------------ create index name on table name (column name) composite index create index name on table name (column name 1, column name 2); create index name on table name (column name 2, column name 1 ); the SQL scan is performed from the back to the back, so the principle of using the index with the most excluded data is as follows: 1. creating an index on a large table makes sense. 2. create an index in the where clause or on a column frequently referenced in the connection condition. 3. the index level should not exceed four layers.