Sunday, 8 May 2022

Imposition of integrity constraints in SQL

Constraints are basically used to impose rules on the table, whenever a row is inserted, updated, or deleted from the table. Constraints prevent the deletion of a table if there are dependencies. The different types of constraints that can be imposed on the table are NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, and CHECK


1. NOT NULL Constraint

Whenever an attribute is declared as NOT NULL then it specifies that the attribute cannot contain a NULL value.



Let us try to inset the following statement

insert into person1 values( ‘ ‘, 17000, 1234567890)

It will generate a error message like 

It is clear that when we try to insert a null value into person1 relation, we get error message, since the attribute name is declared as NOT NULL.

 


 

 

 

 

 

 

 

 

0 comments :

Post a Comment

Note: only a member of this blog may post a comment.

Machine Learning

More

Advertisement

Java Tutorial

More

UGC NET CS TUTORIAL

MFCS
COA
PL-CG
DBMS
OPERATING SYSTEM
SOFTWARE ENG
DSA
TOC-CD
ARTIFICIAL INT

C Programming

More

Python Tutorial

More

Data Structures

More

computer Organization

More
Top