Home Page for the TeradataForum
 
https:

Archives of the TeradataForum

Message Posted: Mon, 28 Mar 2016 @ 10:52:04 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: PK used as USI and not UPI
 
From:   Dsouza, Irwing

If you explicitly define a PRIMARY KEY and not a primary index ,Teradata will default to creating the PK as a PI , if you define a column(s) as a Primary Index and also define a column as a PK, it will create a USI on the PK columns:

     create volatile table T2
     (
     col1 varchar (20)
     ,col2 int
     ,col3 varchar (10) not null
     ,primary key (col3)
     )primary index (col1)


     show table  T2

     show table  T2;

     CREATE SET VOLATILE TABLE T2 ,NO FALLBACK ,
          CHECKSUM = DEFAULT,
          DEFAULT MERGEBLOCKRATIO,
          LOG
          (
           col1 VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC,
           col2 INTEGER,
           col3 VARCHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL)
     PRIMARY INDEX ( col1 )
     UNIQUE INDEX ( col3 )
     ON COMMIT DELETE ROWS;

Irwing Dsouza
Sr. Tech Consultant
Teradata Inc.



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 24 Jul 2020