• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Constraints in TeraData

Constraints

Constrains are conditions prototype rules and applying on tables or columns in other database constraints are

(a)Domain Based – Not null x

Check                           These are  attribute of Teradata

Default

b) Entity based – primary key[pk]

– unique key[UK]

c) Reference based-foreign key [FK]

 

Teradata Constraints

Unique  2 unique values (allows one null)

Primary   2 unique values + Not null+ No duplicate values

Check   2 validates against a condition

References  2 Works like foreign key

Constraints  2 (Condition or restriction on the columns data)

 

At TekSlate, we offer resources that help you in learning various IT courses. We avail both written
 material and demo video tutorials. To gain in-depth knowledge and be on par with practical
 experience, then explore Teradata Training Online.

 

Constraints applied at two levels

a) Column Level  On single column we take constraint

b)Table level  On multiple columns(Composite key) we take constraints.

Syntax Column Name data type constraint <Constraint name>

Primary key/unique/check/references.

Example

Create set table dept

(

D Code integer primary key Not null,

D name varchar(30)

D income integer constraint CHK

Check(DINcome>30000)

)

2Create set table emp

(

EID integer unique not null,

Ename varchar(30)

D Code integer constraint ref

References Dept(D code)

)

 

Table level constraints

Create set table dept1

(

Party ID integer

Pname varchar(30) not null,

P DOB not null, primary key(Pname, PDOB)

)

Note In the above situation p name, PDOB is used for unique identification of the record

 

Screenshot_49

Learn more about Teradata Interview Questions in this blog post.

Multiple column level(composite)

PID

Pname

1

X

2

X

1

Y

2

X

3

X

 

 

Soft referential integrity

2We can remove the data in the parent even the value existed in the child

2Implemented with no check option

2Referential integrity

Screenshot_50

Example

Create set table emp

(

EID Integer unique not null,

Ename varchar(30),

DCode integer constraint ref

References with no check option dept(Dcode)

)

Note

P,K UK required not null at column level because they are associated with index concept

 

For Indepth knowledge on Teradata click on:

Summary
Review Date
Reviewed Item
Constraints in TeraData
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Constraints in TeraData"

Leave a Message

Your email address will not be published. Required fields are marked *

Site Disclaimer, Copyright © 2016 - All Rights Reserved.