SQL Constraints: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 3: Line 3:
=Overview=
=Overview=


 
=<tt>NOT NULL</tt> Constraint=
 


=Primary Key Constraint=
=Primary Key Constraint=

Revision as of 00:00, 23 May 2024

Internal

Overview

NOT NULL Constraint

Primary Key Constraint

CREATE TABLE ...
( ...
  CONSTRAINT pk_someconstraint PRIMARY KEY (somecolumn)
);

Check Constraint

CREATE TABLE ...
( ...
  eye_color CHAR(2) CHECK (eye_color IN ('BR', 'BL', 'GR')),
  ...
);