Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Wednesday 13 August 2014

No Primary index in Teradata

In Teradata, each table requires a primary index. If you don't mention primary index in create table statement, teradata will take automatically create the one based on the DBSControl setting. But in the event where you don't want to create a table with primary index then you can create it.

Teradata requires primary index to distribute data on AMP's. Without primary index data get's distributed randomly on all the AMP's.

We can create table without primary index as below:-

CREATE TABLE SCHEMA_NAME.TABLE_NAME
(
COLUMN_NAME ,
COLUMN_NAME ,
COLUMN_NAME ,
.
.

) NO PRIMARY INDEX;

Let's create employee table with no primary index:-

CREATE TABLE HR.EMPLOYEE
(
EMPLOYEE_NO INT ,
EMPLOYEE_NAME VARCHAR(50) ,
EMP_ADDRESS VARCHAR(50) ,
EMP_CONTACT VARCHAR(10)
) NO PRIMARY INDEX;

If you will find the description of EMPLOYEE table, you will show that its showing "no primary index".



Read Also:- 

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.