DatabaseStatusSyntax FamilyMin Version
PostgreSQL full sql-standard -
MySQL full sql-standard 8.0.16
MariaDB full sql-standard 10.2.1
Oracle full sql-standard -
SQL Server full sql-standard -
SQLite full sql-standard -
Redshift partial sql-standard -
DB2 full sql-standard -
Snowflake partial sql-standard -
BigQuery none - -

Compare Databases

Database Details

PostgreSQL full
CREATE TABLE products (
  id INT PRIMARY KEY,
  price NUMERIC NOT NULL,
  CONSTRAINT price_positive CHECK (price > 0)
);
  • NOT VALID adds the constraint without scanning existing rows; VALIDATE CONSTRAINT validates them later without a long exclusive lock on INSERT/UPDATE.
MySQL full
CREATE TABLE products (
  id INT PRIMARY KEY,
  price DECIMAL(10,2) NOT NULL,
  CONSTRAINT price_positive CHECK (price > 0)
);
  • Enforced since 8.0.16; parsed and ignored before that.
  • Cannot reference user-defined or stored functions.
MariaDB full
CREATE TABLE products (price DECIMAL(10,2) CHECK (price > 0));
  • Enforced since 10.2.1; parsed and ignored before that.
Oracle full
CREATE TABLE products (
  id NUMBER PRIMARY KEY,
  price NUMBER NOT NULL,
  CONSTRAINT price_positive CHECK (price > 0)
);
  • SYSDATE and other deterministic functions are allowed; subqueries, other rows, and other tables are not.
SQL Server full
CREATE TABLE products (
  id INT PRIMARY KEY,
  price DECIMAL(10,2) NOT NULL,
  CONSTRAINT price_positive CHECK (price > 0)
);
  • ALTER TABLE ... WITH NOCHECK ADD CONSTRAINT adds the constraint without validating existing rows; trigger or FK-based workarounds handle cross-table checks.
SQLite full
CREATE TABLE products (
  id INTEGER PRIMARY KEY,
  price REAL NOT NULL CHECK (price > 0)
);
Redshift partial
CREATE TABLE products (
  id INT PRIMARY KEY,
  price DECIMAL(10,2) NOT NULL,
  CONSTRAINT price_positive CHECK (price > 0)
);
  • Accepted and stored in pg_constraint but not evaluated during INSERT, UPDATE, or COPY. Documentation only.
DB2 full
CREATE TABLE products (
  id INT PRIMARY KEY,
  price DECIMAL(10,2) NOT NULL,
  CONSTRAINT price_positive CHECK (price > 0)
);
  • Violations raise SQLSTATE 23513.
  • SET INTEGRITY FOR t OFF suspends checking for bulk loads; re-enable with SET INTEGRITY ... IMMEDIATE CHECKED.
Snowflake partial
CREATE TABLE products (
  id INT PRIMARY KEY,
  price DECIMAL(10,2) NOT NULL,
  CONSTRAINT price_positive CHECK (price > 0)
);
  • Accepted but not evaluated on DML. Only NOT NULL is actually enforced on standard tables.
BigQuery none
  • Not supported. Enforce at the application layer or in an ELT step.