Defining integrity constraint using Alter table

Create table sales(icode number(5),na varchar2(20),qty number(5));
            Create table sales1(icode number(5),na varchar2(20),qty number(5));

    • alter table sales add primary key(icode);
    • alter table sales1 add constraint f_key foreign key(icode) REFERENCES sales
    • alter table sales1 modify (qty number(5) NOT NULL);
    • alter table sales drop primary key;
    • alter table sales drop constraint f_key;

      Disable
                  It is used to disable all integrity constants of the tables
      Syn:- disable [unique][primary key][check][alltriggers]
      Ex:-   alter table sales disable primary key ;
      alter table sales disable constraint f_key;
      Enable
                  It is used to enable all the disable triggers.
      Ex:-   alter table sales enable primary key ;
      alter table sales enable constraint f_key;

For
Online Classes

Contact Us: +919885348743