Primary Key

PRIMARY KEY(Entity Integrity Constraints)
            A PRIMARY KEY is one or more columns in a table used to uniquely identify each row in the table. A primary key column in a table has special attributes.

A single column primary key is called simple key. A multicolumn primary key is called a composite primary key. The only function of primary key in a table is to uniquely identify a row. Only when a record cannot be uniquely identified using the value in a single column, will a composite primary key be defined.
Syn:-   1) columnname datatype(size) PRIMARY KEY  à Column level
2) PRIMARY KEY(columns list)                    à Table Level
Ex:-     1 create table vision2(eno number(5) PRIMARY KEY,na varchar2(20),
sal number(5));
2Create table vision3(eno number(5),code number(5),sal number(5),
PRIMARY KEY (eno,code));

           3  insert into vision2 values(100,’prasad’,3200);
          4 insert into vision2 values(100,’vani’,4300);
          5 insert into vision3 values(100,10,1000);
         6 insert into vision3 values(200,10,2000);
         7 insert into vision3 values(200,10,3200);

For
Online Classes

Contact Us: +919885348743