0% found this document useful (0 votes)
55 views

06-The Relational Database Terminology

The document defines key terminology used in relational database models, including tables, rows, columns, attributes, relations, and tuples. It discusses domain integrity constraints, which require all values in a column to be of the same type, and entity integrity constraints, which require each row to have a unique identifier. Referential integrity constraints require that if one attribute references a value in another relation, that value must exist. The document also covers different types of keys like surrogate keys, composite keys, candidate keys, primary keys, and foreign keys.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

06-The Relational Database Terminology

The document defines key terminology used in relational database models, including tables, rows, columns, attributes, relations, and tuples. It discusses domain integrity constraints, which require all values in a column to be of the same type, and entity integrity constraints, which require each row to have a unique identifier. Referential integrity constraints require that if one attribute references a value in another relation, that value must exist. The document also covers different types of keys like surrogate keys, composite keys, candidate keys, primary keys, and foreign keys.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Relational Database Model

Terminology
1

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
2 Lecture outline
 Relational Database Model Terminology
 Integrity Constraints
 Domain Integrity Constraints
 Entity Integrity Constraints
 Referential Integrity Constraints
 Relational Model Keys
 Example Relations

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
3 Relational Model Terminology
Column /
Attribute /
Field

Student_ID First_Name Department Phone Address Attributes


100 Ahmad IS 0786778899 Khost
101 Shaheen IT 0700800900 Khost
Relation/ Rows /
Table/ 102 Mohsin IT 0777885885 Paktika Tuples /
File 103 Kamal IS 0765889944 Khost Records
104 Rahim IS 0799454545 Logar
105 Rashid IT 0789123456 Nangarhar

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
4 Equivalent Sets of Terms

Table Row Column

File Record Field

Relation Tuple Attribute

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
5
Integrity Constraints
We have defined three constraints so far in our discussion:
 The domain integrity constraint
 The entity integrity constraint
 The referential integrity constraint
The purpose of these three constraints, taken as a whole, is to create database
integrity, which means that the data in our database will be useful, meaningful
data.

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
6 The Domain Integrity Constraint
 It means that all of the values in a column are of the same kind.
 The term domain means a grouping of data that meets a specific type
definition.

Student_ID First_Name Department Phone Address


100 Ahmad IS 0786778899 Khost
101 Shaheen IT 0700800900 Khost
Domain
102 Mohsin IT 0777885885 Paktika
103 Kamal IS 0765889944 Khost
104 Rahim IS 0799454545 Logar
105 Rashid IT 0789123456 Nangarhar

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
7 The Entity Integrity Constraint
 Each row must have a unique data value indicated with a primay or
composite key.
 It is a fundamental requirement for the proper functioning of a relational
database.
Student_ID First_Name Department Phone Address
100 Ahmad IS 0786778899 Khost
101 Shaheen IT 0700800900 Khost
Unique values 102 Mohsin IT 0777885885 Paktika
103 Kamal IS 0765889944 Khost
104 Rahim IS 0799454545 Logar
105 Rashid IT 0789123456 Nangarhar

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
The Referential Integrity Constraint
8  If a value of one attribute of a relation references a value of another attribute
in another relation, then the referenced value must exist.
 It states that the table relationships must always be consistent.
Student Relation
Std_ID First_Name Dept Phone Address

100 Ahmad IS 0786778899 Khost


Course Relation

101 Shaheen IT 0700800900 Khost


Std_ID Course Title Credits
102 Mohsin IT 0777885885 Paktika
100 Database Fundamentals 5
103 Kamal IS 0765889944 Khost
100 Java Programming 4
104 Rahim IS 0799454545 Logar
100 Multimedia 5
105 Rashid IT 0789123456 Nangarhar
100 Web Designing 4

100 Islamic Culture 4

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
9
Relational Model Keys
 A key is one or more columns of a relation that is used to identify a row.
 A key can be unique or nonunique.
Types of Keys
 Surrogate Key
 Composite Key
 Candidate Key
 Primary Key
 Foreign Key

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
10
Surrogate Key
 A surrogate key is a column with a unique, DBMS-assigned identifier that
has been added to a table to be the primary key.
 The unique values of the surrogate key are assigned by the DBMS each
time a row is created, and the values never change.

Surrogate Key

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
11 Composite Key
 A key that contains two or more attributes is called a composite key.
 For example, suppose that we are looking for a unique key for the
EMPLOYEE relation, and the users say that although LastName is not
unique, the combination of LastName and Department is unique.
 Thus, for some reason the users know that two people with the same last name
will never work in the same department. Two Johnsons, for example, will
never work in accounting.
 If that is the case, then the combination (LastName, Department) is a unique
composite key.

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
12 Candidate and Primary Keys
 Candidate keys are keys that uniquely identify each row in a relation.
Candidate keys can be single-column keys, or they can be composite keys.
 The primary key is the candidate key that is chosen as the key that the DBMS
will use to uniquely identify each row in a relation.
 For example, suppose that we have the following EMPLOYEE relation:

Emp_No FirstName Department Phone Email

200 Elham Sales 0786778899 [email protected]

201 Omid Accounting 0700800900 [email protected]

202 Malyar Sales 0777885885 [email protected]

203 Kabir HR 0765889944 [email protected]

204 Khalid Marketing 0799454545 [email protected]

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
13 Defining a Primary Key in MS Access

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
Foreign Key
14  We place values from one relation into a second relation to represent a relationship.
 The values we use are the primary key values of the first relation.
 When we do this, the attribute in the second relation that holds these values is referred to
STUDENT Relation as a foreign key.

Primary Key Std_ID First_Name Dept Phone Address

100 Ahmad IS 0786778899 Khost Foreign Key COURSE Relation

101 Shaheen IT 0700800900 Khost


Std_ID Course Title Credits
102 Mohsin IT 0777885885 Paktika
100 Database Fundamentals 5
103 Kamal IS 0765889944 Khost
100 Java Programming 4
104 Rahim IS 0799454545 Logar
100 Multimedia 5
105 Rashid IT 0789123456 Nangarhar
100 Web Designing 4

100 Islamic Culture 4

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
15
Enforcing Referential Integrity in MS Access

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023
16

Thank You!

Instructor: Najib Ullah Sadaat | Email: [email protected] | Linked In, Twitter, Instagram: @NajeebSadaat | Contacts: 07(0,6,8)6 24 90 24 11/24/2023

You might also like