SQL MOD IMPLICIT. SQL DEFAULT în ALTER TABLE. MySQL. SQL Server. MS Access. Oracle.

SQL DEFAULT în ALTER TABLE

Pentru a crea o restricție DEFAULT pe coloana „Oraș” (City) atunci când tabelul este deja creat, utilizați următorul SQL:

MySQL:
 
ALTER TABLE Persons
ALTER City SET DEFAULT 'Sandnes';

SQL Server:
 
ALTER TABLE Persons
ADD CONSTRAINT df_City
DEFAULT 'Sandnes' FOR City;

MS Access:
 
ALTER TABLE Persons
ALTER COLUMN City SET DEFAULT 'Sandnes';

Oracle:
 
ALTER TABLE Persons
MODIFY City DEFAULT 'Sandnes';