SlideShare a Scribd company logo
By: Rohan Byanjankar
Sainik Awasiya Mahavidyalaya, Sallaghari, Bhaktapur
CONCEPT OF RELATIONAL
DATABASE AND INTEGRITY
CONSTRAINTS
1
• Relational Database Model
• Introduction
• Data integrity (Entity integrity,…)
• Introduction to Integrity Constraints
• Domain Constraint
• Referential Integrity Constraint
Contents
2
• Relational Model was developed by E.F. Codd,
• Most popular database model in the world,
• The data are stored on relation (table), relation in Relational Database
is similar to table where column represents attributes, and
information are stored in rows.
Relational Database Model
ISBN Bname Price Author
000-124-456 The Old Man and
The Sea
Rs. 97 Ernest Hemingway
978-1-85326-067-4 Far from the
Madding Crowd
Rs. 200 Thomas Hardy
978-81-291-0818-0 One Night @ The
Call Center
Rs. 200 Chetan Bhagat
Attributes
Values/information
3
4
• The concept of Primary Key and Foreign Key helps to create logical
relationship between relations.
• Primary Key is a one of the best keys that is chosen by database
designer for the purpose of uniquely identifying all the entities of entity
set.
• A combination of a NOT NULL and UNIQUE. Ensures that a column (or
combination of two or more columns) have an unique identity which helps
to find a particular record in a table more easily and quickly.
• Foreign Key is actually the primary key of one table and serves as
attribute for another table.
• Ensures the referential integrity of the data in one table to match
values in another table
Contd…
5
Contd…
ISBN Bname Price Author
000-124-456 The Old Man and
The Sea
Rs. 97 Ernest Hemingway
978-1-85326-067-4 Far from the
Madding Crowd
Rs. 200 Thomas Hardy
978-81-291-0818-0 One Night @ The
Call Center
Rs. 200 Chetan Bhagat
ID Name Grade ISBN
0001 Sanjay Sharma BBA 978-81-291-0818-0
0002 Sushil Shrestha BSC 000-124-456
0030 Samikshaya Sharma BBA 978-1-85326-067-4
Foreign Key
6
• Integer : INT
• Number (Decimal) : FLOAT or REAL
• Currency : MONEY
• String (fixed) : CHAR
• String (Variable) : VARCHAR
• Date : DATETIME
Data Types and their Notation in SQL SERVER
7
• The fundamental set of rules,
• Implemented for the purpose of maintaining accuracy,
reliability, and consistency in data,
• Helps to avoid accidental deletion of data,
• Prevents the entry of invalid data in database,
Data integrity
8
Entity Integrity
- Generally applies on an attribute,
- Concerned with the presence of primary key in each relation(table),
- It advocates the following:
- Primary Key must be NOT NULL,
- Primary Key must be UNIQUE,
NOTE:
IF THERE IS NULL VALUE FOR A PRIMARY KEY, THEN IT
WILL BE UNATTAINABLE FOR US TO IDENTIFY ALL THE
TUPLES INDIVIDUALLY.
Types of Data Integrity
ISBN Bname Price Author
000-124-456 The Old Man and
The Sea
Rs. 97 Ernest Hemingway
978-1-85326-067-4 Far from the
Madding Crowd
Rs. 200 Thomas Hardy
978-81-291-0818-0 One Night @ The
Call Center
Rs. 200 Chetan Bhagat
PrimaryKey
IN SQL (Entity Integrity)
CREATE TABLE Library (
ISBN INT,
Bname VARCHAR (20),
Price MONEY,
Author VARCHAR (20),
CONSTRAINT pk_id PRIMARY KEY (ISBN));
10
•Domain Integrity
• Domain Constraint is one of the elementary form of integrity
constraint that helps to maintain accuracy and consistency,
• Helps to avoid duplication of data,
•Referential Integrity
• Enables to establish relationship between two relations through
the application of concept of PRIMARY KEY and FOREIGN
KEY.
Contd…
11
12
• Set of rules that helps to maintain correctness of data,
• Prevent from accidental deletion and insertion of data,
•Types of Integrity constraint
• Domain Constraint
• Referential Integrity Constraint
• Assertion
• Triggers
Integrity Constraint
13
• A domain is defined as the set of all unique values that can be
allowed for an attribute.
• For example, a domain of day-of-week is Sunday, Monday,
Tuesday ... Saturday.
• Domain Constraint is one of the elementary form of integrity
constraint that helps to maintain accuracy and consistency,
• Helps to avoid common errors such as date : 30th February, 2010…
• CHECK, UNIQUE, NOT NULL, PRIMARY KEY are the
examples of Domain Constraints
Domain Constraint
14
IN SQL (Domain Integrity)
CREATE TABLE Student (
ID INT PRIMARY KEY,
Sname VARCHAR (20) NOT NULL,
Grade VARCHAR (20),
Age INT CHECK(Age BETWEEN 19 AND 21),
Email_id VARCHAR (30) UNIQUE);
ID Sname Grade Age Email_id
0001 Sanjay Sharma BBA 20 sanjay120@gmail.com
0002 Sushil Shrestha BSC 21 Shth.susil@yahoo.com
0003 Samikshaya Sharma BBA 19 Sami.sharma@rediff.com
In Case:
INERT INTO Student VALUES (0004, ‘Nisha Thapa Magar’, ‘BBA’, 22,
‘sujan98@gmail.com’)
It will not be accepted as Age>21
CHECK
UNIQUE
Domain Integrity
PRIMARY KEY
NOT NULL
15
• Has sturdy link with entity integrity,
• The referential integrity relies on the entity integrity,
• Referential integrity is a property of data which, when satisfied,
requires every value of one attribute (column) of a relation (table)
to exist as a value of another attribute in a different (or the same)
relation (table).
• Referential Integrity is based on the concept of foreign key,
Referential Integrity Constraint
16
IN SQL (Entity Integrity)
CREATE TABLE Library (
ISBN INT,
Bname VARCHAR (20),
Price MONEY,
Author VARCHAR (20),
CONSTRAINT pk_id PRIMARY
KEY (ISBN));
IN SQL (Referential
Integrity)
CREATE TABLE Student (
ID INT PRIMARY KEY,
Sname VARCHAR (20),
Grade VARCHAR (20),
ISBN INT FOREIGN KEY
REFERENCES Library (ISBN));
ISBN INT
17
ISBN Bname Price Author
000-124-456 The Old Man and
The Sea
Rs. 97 Ernest Hemingway
978-1-85326-067-4 Far from the
Madding Crowd
Rs. 200 Thomas Hardy
978-81-291-0818-0 One Night @ The
Call Center
Rs. 200 Chetan Bhagat
ID Sname Grade ISBN
0001 Sanjay Sharma BBA 978-81-291-0818-0
0002 Sushil Shrestha BSC 000-124-456
0030 Samikshaya Sharma BBA 978-1-85326-067-4
Foreign Key
Library
Student
18
•Assertion
• General purpose CHECK that allows for the enforcement
of any condition over entire database
• Triggers
• Special type of stored procedure that automatically
gets executed in the DBMS in response to specific
change in database
Contd…

More Related Content

What's hot

Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
wmassie
 
Types of keys dbms
Types of keys dbmsTypes of keys dbms
Types of keys dbms
Surkhab Shelly
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
sunanditaAnand
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
Shishir Aryal
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
Wings Interactive
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
Naresh Kumar
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
Vignesh Saravanan
 
Sql operators & functions 3
Sql operators & functions 3Sql operators & functions 3
Sql operators & functions 3
Dr. C.V. Suresh Babu
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
shekhar1991
 
Array in c
Array in cArray in c
Array in c
Ravi Gelani
 
DBMS Keys
DBMS KeysDBMS Keys
DBMS Keys
Tarun Maheshwari
 
Joins in dbms and types
Joins in dbms and typesJoins in dbms and types
Joins in dbms and types
university of Gujrat, pakistan
 
Trigger
TriggerTrigger
Arrays Basics
Arrays BasicsArrays Basics
Arrays Basics
Nikhil Pandit
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
Chirag vasava
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
Vigneshwaran Sankaran
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
Anusha sivakumar
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
topu93
 
Er model
Er modelEr model
Er model
Soumyajit Dutta
 
The Relational Model
The Relational ModelThe Relational Model
The Relational Model
Bhandari Nawaraj
 

What's hot (20)

Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
Types of keys dbms
Types of keys dbmsTypes of keys dbms
Types of keys dbms
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
 
Sql operators & functions 3
Sql operators & functions 3Sql operators & functions 3
Sql operators & functions 3
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Array in c
Array in cArray in c
Array in c
 
DBMS Keys
DBMS KeysDBMS Keys
DBMS Keys
 
Joins in dbms and types
Joins in dbms and typesJoins in dbms and types
Joins in dbms and types
 
Trigger
TriggerTrigger
Trigger
 
Arrays Basics
Arrays BasicsArrays Basics
Arrays Basics
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
 
Presentation on array
Presentation on array Presentation on array
Presentation on array
 
Er model
Er modelEr model
Er model
 
The Relational Model
The Relational ModelThe Relational Model
The Relational Model
 

Viewers also liked

Sql
SqlSql
Data integrity
Data integrityData integrity
Data integrity
Rahul Gupta
 
3 summary
3 summary3 summary
Relational keys
Relational keysRelational keys
Relational keys
Sana2020
 
Basic example using database component
Basic example using database componentBasic example using database component
Basic example using database component
prudhvivreddy
 
Chap08
Chap08Chap08
Digital Menu Boards Guide 2014
Digital Menu Boards Guide 2014 Digital Menu Boards Guide 2014
Digital Menu Boards Guide 2014
Drew Harding
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
Tech_MX
 
Key database terms
Key database termsKey database terms
Key database terms
listergc
 
integrity constraints
integrity constraintsintegrity constraints
integrity constraints
madhav bansal
 
How to sharpen skis
How to sharpen skisHow to sharpen skis
How to sharpen skis
foleycs
 
Whitmore Sonja 3.3
Whitmore Sonja 3.3Whitmore Sonja 3.3
Whitmore Sonja 3.3
SonjaGWhitmore
 
zulkernine_zanonudin
zulkernine_zanonudinzulkernine_zanonudin
zulkernine_zanonudin
zulkernine zanonudin
 
KEI_Book_Sample
KEI_Book_SampleKEI_Book_Sample
KEI_Book_Sample
Nick Boucher
 
Análisis y perspectivas del cluster canalero
Análisis y perspectivas del cluster canaleroAnálisis y perspectivas del cluster canalero
Análisis y perspectivas del cluster canalero
César Valdés P.
 

Viewers also liked (15)

Sql
SqlSql
Sql
 
Data integrity
Data integrityData integrity
Data integrity
 
3 summary
3 summary3 summary
3 summary
 
Relational keys
Relational keysRelational keys
Relational keys
 
Basic example using database component
Basic example using database componentBasic example using database component
Basic example using database component
 
Chap08
Chap08Chap08
Chap08
 
Digital Menu Boards Guide 2014
Digital Menu Boards Guide 2014 Digital Menu Boards Guide 2014
Digital Menu Boards Guide 2014
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
 
Key database terms
Key database termsKey database terms
Key database terms
 
integrity constraints
integrity constraintsintegrity constraints
integrity constraints
 
How to sharpen skis
How to sharpen skisHow to sharpen skis
How to sharpen skis
 
Whitmore Sonja 3.3
Whitmore Sonja 3.3Whitmore Sonja 3.3
Whitmore Sonja 3.3
 
zulkernine_zanonudin
zulkernine_zanonudinzulkernine_zanonudin
zulkernine_zanonudin
 
KEI_Book_Sample
KEI_Book_SampleKEI_Book_Sample
KEI_Book_Sample
 
Análisis y perspectivas del cluster canalero
Análisis y perspectivas del cluster canaleroAnálisis y perspectivas del cluster canalero
Análisis y perspectivas del cluster canalero
 

Similar to Concept of Relational Database and Integrity Constraints [DIFFERENCE BETWEEN PRIMARY KEY AND UNIQUE AND NOT NULL].

Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERA
Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERAGeek Sync | Data Integrity Demystified - Deborah Melkin | IDERA
Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERA
IDERA Software
 
Sql introduction
Sql introductionSql introduction
Sql introduction
Bhavya Chawla
 
Structured Query Language (SQL) _ Edu4Sure Training.pptx
Structured Query Language (SQL) _ Edu4Sure Training.pptxStructured Query Language (SQL) _ Edu4Sure Training.pptx
Structured Query Language (SQL) _ Edu4Sure Training.pptx
Edu4Sure
 
NoSQL, SQL, NewSQL - methods of structuring data.
NoSQL, SQL, NewSQL - methods of structuring data.NoSQL, SQL, NewSQL - methods of structuring data.
NoSQL, SQL, NewSQL - methods of structuring data.
Tony Rogerson
 
Relational database management system
Relational database management systemRelational database management system
Relational database management system
Praveen Soni
 
Data_Preparation_Modeling_Evaluation.ppt
Data_Preparation_Modeling_Evaluation.pptData_Preparation_Modeling_Evaluation.ppt
Data_Preparation_Modeling_Evaluation.ppt
AronMozart1
 
demo2.ppt
demo2.pptdemo2.ppt
demo2.ppt
crazyvirtue
 
ER Digramms by Harshal wagh
ER Digramms by Harshal waghER Digramms by Harshal wagh
ER Digramms by Harshal wagh
harshalkwagh999
 
Complete SQL Tutorial In Hindi By Rishabh Mishra.pdf
Complete SQL Tutorial In Hindi By Rishabh Mishra.pdfComplete SQL Tutorial In Hindi By Rishabh Mishra.pdf
Complete SQL Tutorial In Hindi By Rishabh Mishra.pdf
ssuserb5bb0e
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
SSN College of Engineering, Kalavakkam
 
19IS305_U2_LP4_LM4-22-23.pdf
19IS305_U2_LP4_LM4-22-23.pdf19IS305_U2_LP4_LM4-22-23.pdf
19IS305_U2_LP4_LM4-22-23.pdf
GOWTHAMR721887
 
Csis110 trzos-c1 ms access
Csis110 trzos-c1 ms accessCsis110 trzos-c1 ms access
Csis110 trzos-c1 ms access
tomtrzos
 
Exalead managing terrabytes
Exalead   managing terrabytesExalead   managing terrabytes
Exalead managing terrabytes
Jérémie BORDIER
 
Data_base.pptx
Data_base.pptxData_base.pptx
Data_base.pptx
Mohit89650
 
5. relational structure
5. relational structure5. relational structure
5. relational structure
khoahuy82
 

Similar to Concept of Relational Database and Integrity Constraints [DIFFERENCE BETWEEN PRIMARY KEY AND UNIQUE AND NOT NULL]. (15)

Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERA
Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERAGeek Sync | Data Integrity Demystified - Deborah Melkin | IDERA
Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERA
 
Sql introduction
Sql introductionSql introduction
Sql introduction
 
Structured Query Language (SQL) _ Edu4Sure Training.pptx
Structured Query Language (SQL) _ Edu4Sure Training.pptxStructured Query Language (SQL) _ Edu4Sure Training.pptx
Structured Query Language (SQL) _ Edu4Sure Training.pptx
 
NoSQL, SQL, NewSQL - methods of structuring data.
NoSQL, SQL, NewSQL - methods of structuring data.NoSQL, SQL, NewSQL - methods of structuring data.
NoSQL, SQL, NewSQL - methods of structuring data.
 
Relational database management system
Relational database management systemRelational database management system
Relational database management system
 
Data_Preparation_Modeling_Evaluation.ppt
Data_Preparation_Modeling_Evaluation.pptData_Preparation_Modeling_Evaluation.ppt
Data_Preparation_Modeling_Evaluation.ppt
 
demo2.ppt
demo2.pptdemo2.ppt
demo2.ppt
 
ER Digramms by Harshal wagh
ER Digramms by Harshal waghER Digramms by Harshal wagh
ER Digramms by Harshal wagh
 
Complete SQL Tutorial In Hindi By Rishabh Mishra.pdf
Complete SQL Tutorial In Hindi By Rishabh Mishra.pdfComplete SQL Tutorial In Hindi By Rishabh Mishra.pdf
Complete SQL Tutorial In Hindi By Rishabh Mishra.pdf
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
19IS305_U2_LP4_LM4-22-23.pdf
19IS305_U2_LP4_LM4-22-23.pdf19IS305_U2_LP4_LM4-22-23.pdf
19IS305_U2_LP4_LM4-22-23.pdf
 
Csis110 trzos-c1 ms access
Csis110 trzos-c1 ms accessCsis110 trzos-c1 ms access
Csis110 trzos-c1 ms access
 
Exalead managing terrabytes
Exalead   managing terrabytesExalead   managing terrabytes
Exalead managing terrabytes
 
Data_base.pptx
Data_base.pptxData_base.pptx
Data_base.pptx
 
5. relational structure
5. relational structure5. relational structure
5. relational structure
 

More from Rohan Byanjankar

12 Reasons for Never, Ever carrying out Data Analysis
12 Reasons for Never, Ever carrying out Data Analysis12 Reasons for Never, Ever carrying out Data Analysis
12 Reasons for Never, Ever carrying out Data Analysis
Rohan Byanjankar
 
Concept of annuity
Concept of annuityConcept of annuity
Concept of annuity
Rohan Byanjankar
 
Risk Associated with Derivative Markets
Risk Associated with Derivative MarketsRisk Associated with Derivative Markets
Risk Associated with Derivative Markets
Rohan Byanjankar
 
Relationship between Average Revenue (AR), Marginal Revenue (MR), and Elastic...
Relationship between Average Revenue (AR), Marginal Revenue (MR), and Elastic...Relationship between Average Revenue (AR), Marginal Revenue (MR), and Elastic...
Relationship between Average Revenue (AR), Marginal Revenue (MR), and Elastic...
Rohan Byanjankar
 
Multiplier: Concept, Types, and Derivation of each type of Multiplier
Multiplier: Concept, Types, and Derivation of each type of MultiplierMultiplier: Concept, Types, and Derivation of each type of Multiplier
Multiplier: Concept, Types, and Derivation of each type of Multiplier
Rohan Byanjankar
 
Origin of Nepal: Nepal as a Sovereign Country
Origin of Nepal: Nepal as a Sovereign CountryOrigin of Nepal: Nepal as a Sovereign Country
Origin of Nepal: Nepal as a Sovereign Country
Rohan Byanjankar
 
Understanding Interest Rate Swap: Price of Interest Rate Swap and Value of In...
Understanding Interest Rate Swap: Price of Interest Rate Swap and Value of In...Understanding Interest Rate Swap: Price of Interest Rate Swap and Value of In...
Understanding Interest Rate Swap: Price of Interest Rate Swap and Value of In...
Rohan Byanjankar
 
Human Development Index; Components of Human Development Index, Significance ...
Human Development Index; Components of Human Development Index, Significance ...Human Development Index; Components of Human Development Index, Significance ...
Human Development Index; Components of Human Development Index, Significance ...
Rohan Byanjankar
 
A Study on Online Health Service at HamroDoctor
A Study on Online Health Service at HamroDoctorA Study on Online Health Service at HamroDoctor
A Study on Online Health Service at HamroDoctor
Rohan Byanjankar
 
Siddhi Memorial Foundation, Bhaktapur, Nepal
Siddhi Memorial Foundation, Bhaktapur, NepalSiddhi Memorial Foundation, Bhaktapur, Nepal
Siddhi Memorial Foundation, Bhaktapur, Nepal
Rohan Byanjankar
 
Trade and Export Promotion Centre, Nepal
Trade and Export Promotion Centre, NepalTrade and Export Promotion Centre, Nepal
Trade and Export Promotion Centre, Nepal
Rohan Byanjankar
 
Introduction to HASERA
Introduction to HASERAIntroduction to HASERA
Introduction to HASERA
Rohan Byanjankar
 
Sociology and Religion: Religion as a Social Institution
Sociology and Religion: Religion as a Social InstitutionSociology and Religion: Religion as a Social Institution
Sociology and Religion: Religion as a Social Institution
Rohan Byanjankar
 
Inductive and Deductive Approach to Research. Difference between Inductive an...
Inductive and Deductive Approach to Research. Difference between Inductive an...Inductive and Deductive Approach to Research. Difference between Inductive an...
Inductive and Deductive Approach to Research. Difference between Inductive an...
Rohan Byanjankar
 
Online Business; What is E-commerce; What are the points to be considered whi...
Online Business; What is E-commerce; What are the points to be considered whi...Online Business; What is E-commerce; What are the points to be considered whi...
Online Business; What is E-commerce; What are the points to be considered whi...
Rohan Byanjankar
 
NEPAL; Demographic Analysis of Nepal; Comparative Study of Various Census and...
NEPAL; Demographic Analysis of Nepal; Comparative Study of Various Census and...NEPAL; Demographic Analysis of Nepal; Comparative Study of Various Census and...
NEPAL; Demographic Analysis of Nepal; Comparative Study of Various Census and...
Rohan Byanjankar
 
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Rohan Byanjankar
 
Microeconomics: Concept of Indifference Curve and Budget Line. Definition of ...
Microeconomics: Concept of Indifference Curve and Budget Line. Definition of ...Microeconomics: Concept of Indifference Curve and Budget Line. Definition of ...
Microeconomics: Concept of Indifference Curve and Budget Line. Definition of ...
Rohan Byanjankar
 
Difference between selling concept and marketing concept
Difference between selling concept and marketing conceptDifference between selling concept and marketing concept
Difference between selling concept and marketing concept
Rohan Byanjankar
 

More from Rohan Byanjankar (19)

12 Reasons for Never, Ever carrying out Data Analysis
12 Reasons for Never, Ever carrying out Data Analysis12 Reasons for Never, Ever carrying out Data Analysis
12 Reasons for Never, Ever carrying out Data Analysis
 
Concept of annuity
Concept of annuityConcept of annuity
Concept of annuity
 
Risk Associated with Derivative Markets
Risk Associated with Derivative MarketsRisk Associated with Derivative Markets
Risk Associated with Derivative Markets
 
Relationship between Average Revenue (AR), Marginal Revenue (MR), and Elastic...
Relationship between Average Revenue (AR), Marginal Revenue (MR), and Elastic...Relationship between Average Revenue (AR), Marginal Revenue (MR), and Elastic...
Relationship between Average Revenue (AR), Marginal Revenue (MR), and Elastic...
 
Multiplier: Concept, Types, and Derivation of each type of Multiplier
Multiplier: Concept, Types, and Derivation of each type of MultiplierMultiplier: Concept, Types, and Derivation of each type of Multiplier
Multiplier: Concept, Types, and Derivation of each type of Multiplier
 
Origin of Nepal: Nepal as a Sovereign Country
Origin of Nepal: Nepal as a Sovereign CountryOrigin of Nepal: Nepal as a Sovereign Country
Origin of Nepal: Nepal as a Sovereign Country
 
Understanding Interest Rate Swap: Price of Interest Rate Swap and Value of In...
Understanding Interest Rate Swap: Price of Interest Rate Swap and Value of In...Understanding Interest Rate Swap: Price of Interest Rate Swap and Value of In...
Understanding Interest Rate Swap: Price of Interest Rate Swap and Value of In...
 
Human Development Index; Components of Human Development Index, Significance ...
Human Development Index; Components of Human Development Index, Significance ...Human Development Index; Components of Human Development Index, Significance ...
Human Development Index; Components of Human Development Index, Significance ...
 
A Study on Online Health Service at HamroDoctor
A Study on Online Health Service at HamroDoctorA Study on Online Health Service at HamroDoctor
A Study on Online Health Service at HamroDoctor
 
Siddhi Memorial Foundation, Bhaktapur, Nepal
Siddhi Memorial Foundation, Bhaktapur, NepalSiddhi Memorial Foundation, Bhaktapur, Nepal
Siddhi Memorial Foundation, Bhaktapur, Nepal
 
Trade and Export Promotion Centre, Nepal
Trade and Export Promotion Centre, NepalTrade and Export Promotion Centre, Nepal
Trade and Export Promotion Centre, Nepal
 
Introduction to HASERA
Introduction to HASERAIntroduction to HASERA
Introduction to HASERA
 
Sociology and Religion: Religion as a Social Institution
Sociology and Religion: Religion as a Social InstitutionSociology and Religion: Religion as a Social Institution
Sociology and Religion: Religion as a Social Institution
 
Inductive and Deductive Approach to Research. Difference between Inductive an...
Inductive and Deductive Approach to Research. Difference between Inductive an...Inductive and Deductive Approach to Research. Difference between Inductive an...
Inductive and Deductive Approach to Research. Difference between Inductive an...
 
Online Business; What is E-commerce; What are the points to be considered whi...
Online Business; What is E-commerce; What are the points to be considered whi...Online Business; What is E-commerce; What are the points to be considered whi...
Online Business; What is E-commerce; What are the points to be considered whi...
 
NEPAL; Demographic Analysis of Nepal; Comparative Study of Various Census and...
NEPAL; Demographic Analysis of Nepal; Comparative Study of Various Census and...NEPAL; Demographic Analysis of Nepal; Comparative Study of Various Census and...
NEPAL; Demographic Analysis of Nepal; Comparative Study of Various Census and...
 
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
Concept of Structured Query Language (SQL) in SQL server as well as MySql. BB...
 
Microeconomics: Concept of Indifference Curve and Budget Line. Definition of ...
Microeconomics: Concept of Indifference Curve and Budget Line. Definition of ...Microeconomics: Concept of Indifference Curve and Budget Line. Definition of ...
Microeconomics: Concept of Indifference Curve and Budget Line. Definition of ...
 
Difference between selling concept and marketing concept
Difference between selling concept and marketing conceptDifference between selling concept and marketing concept
Difference between selling concept and marketing concept
 

Recently uploaded

DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 

Recently uploaded (20)

DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 

Concept of Relational Database and Integrity Constraints [DIFFERENCE BETWEEN PRIMARY KEY AND UNIQUE AND NOT NULL].

  • 1. By: Rohan Byanjankar Sainik Awasiya Mahavidyalaya, Sallaghari, Bhaktapur CONCEPT OF RELATIONAL DATABASE AND INTEGRITY CONSTRAINTS 1
  • 2. • Relational Database Model • Introduction • Data integrity (Entity integrity,…) • Introduction to Integrity Constraints • Domain Constraint • Referential Integrity Constraint Contents 2
  • 3. • Relational Model was developed by E.F. Codd, • Most popular database model in the world, • The data are stored on relation (table), relation in Relational Database is similar to table where column represents attributes, and information are stored in rows. Relational Database Model ISBN Bname Price Author 000-124-456 The Old Man and The Sea Rs. 97 Ernest Hemingway 978-1-85326-067-4 Far from the Madding Crowd Rs. 200 Thomas Hardy 978-81-291-0818-0 One Night @ The Call Center Rs. 200 Chetan Bhagat Attributes Values/information 3
  • 4. 4 • The concept of Primary Key and Foreign Key helps to create logical relationship between relations. • Primary Key is a one of the best keys that is chosen by database designer for the purpose of uniquely identifying all the entities of entity set. • A combination of a NOT NULL and UNIQUE. Ensures that a column (or combination of two or more columns) have an unique identity which helps to find a particular record in a table more easily and quickly. • Foreign Key is actually the primary key of one table and serves as attribute for another table. • Ensures the referential integrity of the data in one table to match values in another table Contd…
  • 5. 5 Contd… ISBN Bname Price Author 000-124-456 The Old Man and The Sea Rs. 97 Ernest Hemingway 978-1-85326-067-4 Far from the Madding Crowd Rs. 200 Thomas Hardy 978-81-291-0818-0 One Night @ The Call Center Rs. 200 Chetan Bhagat ID Name Grade ISBN 0001 Sanjay Sharma BBA 978-81-291-0818-0 0002 Sushil Shrestha BSC 000-124-456 0030 Samikshaya Sharma BBA 978-1-85326-067-4 Foreign Key
  • 6. 6 • Integer : INT • Number (Decimal) : FLOAT or REAL • Currency : MONEY • String (fixed) : CHAR • String (Variable) : VARCHAR • Date : DATETIME Data Types and their Notation in SQL SERVER
  • 7. 7 • The fundamental set of rules, • Implemented for the purpose of maintaining accuracy, reliability, and consistency in data, • Helps to avoid accidental deletion of data, • Prevents the entry of invalid data in database, Data integrity
  • 8. 8 Entity Integrity - Generally applies on an attribute, - Concerned with the presence of primary key in each relation(table), - It advocates the following: - Primary Key must be NOT NULL, - Primary Key must be UNIQUE, NOTE: IF THERE IS NULL VALUE FOR A PRIMARY KEY, THEN IT WILL BE UNATTAINABLE FOR US TO IDENTIFY ALL THE TUPLES INDIVIDUALLY. Types of Data Integrity
  • 9. ISBN Bname Price Author 000-124-456 The Old Man and The Sea Rs. 97 Ernest Hemingway 978-1-85326-067-4 Far from the Madding Crowd Rs. 200 Thomas Hardy 978-81-291-0818-0 One Night @ The Call Center Rs. 200 Chetan Bhagat PrimaryKey IN SQL (Entity Integrity) CREATE TABLE Library ( ISBN INT, Bname VARCHAR (20), Price MONEY, Author VARCHAR (20), CONSTRAINT pk_id PRIMARY KEY (ISBN));
  • 10. 10 •Domain Integrity • Domain Constraint is one of the elementary form of integrity constraint that helps to maintain accuracy and consistency, • Helps to avoid duplication of data, •Referential Integrity • Enables to establish relationship between two relations through the application of concept of PRIMARY KEY and FOREIGN KEY. Contd…
  • 11. 11
  • 12. 12 • Set of rules that helps to maintain correctness of data, • Prevent from accidental deletion and insertion of data, •Types of Integrity constraint • Domain Constraint • Referential Integrity Constraint • Assertion • Triggers Integrity Constraint
  • 13. 13 • A domain is defined as the set of all unique values that can be allowed for an attribute. • For example, a domain of day-of-week is Sunday, Monday, Tuesday ... Saturday. • Domain Constraint is one of the elementary form of integrity constraint that helps to maintain accuracy and consistency, • Helps to avoid common errors such as date : 30th February, 2010… • CHECK, UNIQUE, NOT NULL, PRIMARY KEY are the examples of Domain Constraints Domain Constraint
  • 14. 14 IN SQL (Domain Integrity) CREATE TABLE Student ( ID INT PRIMARY KEY, Sname VARCHAR (20) NOT NULL, Grade VARCHAR (20), Age INT CHECK(Age BETWEEN 19 AND 21), Email_id VARCHAR (30) UNIQUE); ID Sname Grade Age Email_id 0001 Sanjay Sharma BBA 20 sanjay120@gmail.com 0002 Sushil Shrestha BSC 21 Shth.susil@yahoo.com 0003 Samikshaya Sharma BBA 19 Sami.sharma@rediff.com In Case: INERT INTO Student VALUES (0004, ‘Nisha Thapa Magar’, ‘BBA’, 22, ‘sujan98@gmail.com’) It will not be accepted as Age>21 CHECK UNIQUE Domain Integrity PRIMARY KEY NOT NULL
  • 15. 15 • Has sturdy link with entity integrity, • The referential integrity relies on the entity integrity, • Referential integrity is a property of data which, when satisfied, requires every value of one attribute (column) of a relation (table) to exist as a value of another attribute in a different (or the same) relation (table). • Referential Integrity is based on the concept of foreign key, Referential Integrity Constraint
  • 16. 16 IN SQL (Entity Integrity) CREATE TABLE Library ( ISBN INT, Bname VARCHAR (20), Price MONEY, Author VARCHAR (20), CONSTRAINT pk_id PRIMARY KEY (ISBN)); IN SQL (Referential Integrity) CREATE TABLE Student ( ID INT PRIMARY KEY, Sname VARCHAR (20), Grade VARCHAR (20), ISBN INT FOREIGN KEY REFERENCES Library (ISBN)); ISBN INT
  • 17. 17 ISBN Bname Price Author 000-124-456 The Old Man and The Sea Rs. 97 Ernest Hemingway 978-1-85326-067-4 Far from the Madding Crowd Rs. 200 Thomas Hardy 978-81-291-0818-0 One Night @ The Call Center Rs. 200 Chetan Bhagat ID Sname Grade ISBN 0001 Sanjay Sharma BBA 978-81-291-0818-0 0002 Sushil Shrestha BSC 000-124-456 0030 Samikshaya Sharma BBA 978-1-85326-067-4 Foreign Key Library Student
  • 18. 18 •Assertion • General purpose CHECK that allows for the enforcement of any condition over entire database • Triggers • Special type of stored procedure that automatically gets executed in the DBMS in response to specific change in database Contd…