Eine Einführung in
SQL
Add a constraint to a table.
SQLite
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to SQLite
none
DB2
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to DB2
ALTER TABLE documentation.
DB2 seemingly does not permit this operation - any help would be appreciated.
MS Access
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to MS Access
The check is not supported.
PostgreSQL
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to PostgreSQL
ALTER TABLE
Oracle
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to Oracle
ALTER TABLE t DROP COLUMN c
MS SQL Server
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to MS SQL Server
none
MySQL
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to MySQL
The check gets ignored.
Sybase
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to Sybase
none
Mimer SQL
We can add a constraint
a foreign key reference
a UNIQUE requirement
a CHECK constraint
This is in the SQL standard
ALTER TABLE
Execute tidy up
code
silently
DROP TABLE a
Execute set up
code
CREATE TABLE a(x INTEGER, y INTEGER); INSERT INTO a VALUES (1,2);
ALTER TABLE a ADD CHECK (y>0)
Specific to Mimer SQL
none