Setting a Unique Constraint : Unique « Constraints « Oracle PL / SQL






Setting a Unique Constraint

   
SQL>
SQL>
SQL> CREATE TABLE myTable (
  2     Name    VARCHAR(50) NOT NULL,
  3     PhoneNo VARCHAR(15) DEFAULT 'Unknown Phone' NOT NULL,
  4     CONSTRAINT MyUniqueKey UNIQUE (Name)
  5  );

Table created.

SQL>
SQL> drop table myTable;

Table dropped.

SQL>
SQL>

   
    
    
  








Related examples in the same category

1.if a column is not explicitely defined as not null, nulls can be inserted multiple times
2.Vialate the unique contraint: try to insert the same value
3.A unique constraint can be extended over multiple columns
4.Add unique containt to a varchar2 type column
5.Create a table with 'unique deferrable initially immediate'
6.Add unique constraints
7.ORA-00001: unique constraint (JAVA2S.JOB_UNIQUE_IN_TEAMID) violated
8.Unique value column