Naming contraints : Add Constraint « Constraints « Oracle PL / SQL






Naming contraints

    

SQL> create table salary
  2  ( grade      NUMBER(2)   constraint S_PK primary key
  3  , lowerlimit NUMBER(6,2) constraint S_LOWER_NN
  4                           not null
  5                           constraint S_LOWER_CHK
  6                           check (lowerlimit >= 0)
  7  , upperlimit NUMBER(6,2) constraint S_UPPER_NN
  8                           not null
  9  , bonus      NUMBER(6,2) constraint S_BONUS_NN
 10                           not null
 11  , constraint S_LO_UP_CHK check
 12                           (lowerlimit <= upperlimit)
 13  ) ;

Table created.

SQL>
SQL>
SQL> drop table salary;

Table dropped.

   
    
    
    
  








Related examples in the same category

1.Adding constraints to a table: not null
2.Alter table to add constraint with name
3.Salary column value cannot be greater than 1000