Converting NOPI to PI table

Ratings:
(4)
Views:747
Banner-Img
  • Share this blog:

Converting NOPI to PI table

There are 2 steps a) Create a multi set table with the same structure and take a primary index on that table. Create a multi set table New-tet(Party id integer, party name Varchar(30)primary index(Party id) b)Insert data into new- tet, drop tet table and rename new-tet to tet   i)Insert into new- tet select* from tet ii) drop table tet iii) Rename table new –tet to tet Altering a primary index(it table is empty and it is not having NOPI) Alter table test modify primary index(Party name)   Default primary Index If we don’t take and index on the table the system creats a primary index in the below process

  1.  The unique key(or) primary key column consider as UPI
  2.  IF No unique kdy (or) primary key it create on the first column NOPI.

  Note If both primary key and unique key columns available it takes primary index(PI)on primary key column and (Unique primary index) and unique columns as USI(Secondary index)     

Difference between primary index and primary key

Primary index(P.I)

Primary key (P.K)

 

Primary index mandatory

Primary key optional

Max 64 Columns combination

 

 No limit on no. of columns to composite

effects data distribution

Doesn’t effect data distribution

can take duplications and null

 Doesn’t allow null and duplicates.
 physical mechanism  Logical mechanism

Cannot be drop

Cannot be drop

Queries stores and retrieve faster w.r.to PI etc….

 

 

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox