SlideShare a Scribd company logo
1 of 42
Download to read offline
Database Management System
Part-2
Dr. K ADISESHA
Introduction
E-R model Components
E-R diagram
Relation Algebra
Relational Keys
2
Entity-Relationship model
Prof. K. Adisesha
Prof. K. Adisesha
Introduction
Prof. K. Adisesha
3
ER model:
ER model stands for an Entity-Relationship model. It is a high-level data model.
➢ This model is used to define the data elements and relationship for a specified system.
➢ It develops a conceptual design for the database. It also develops a very simple and
easy to design view of data.
➢ In ER modeling, the database structure is portrayed as a diagram called an entity-
relationship diagram.
➢Example, Suppose we design a school database. In
this database, the student will be an entity with
attributes like address, name, id, age, etc.
E-R diagram
Prof. K. Adisesha
4
Components of E-R model:
ER-Diagram is a visual representation of data that describes how data is related to each
other.
➢ Entity
➢ Attribute
➢ Relationship
E-R diagram
Prof. K. Adisesha
5
Components of E-R model:
ER-Diagram is a visual representation of data that describes how data is related to each
other.
Entity:
✓ An Entity can be any object, place, person or class.
Attribute:
✓ An Attribute describes a property or characteristic of an entity.
✓ Example: Roll_No, Name and Birth date can be attributes of a student
Relationship:
✓ A relationship type is a meaningful association between entity types.
✓ Relationship types are represented on the E-R diagram by a series of lines.
E-R diagram
Prof. K. Adisesha
6
Different notations of E-R diagram:
ER-Diagram is a visual representation of data that describes how data is related to each
other.
➢ Different notations of E-R diagram:
❖ Entity: An entity is represented using rectangles.
❖ Attribute: Attributes are represented by means of eclipses.
❖ Relationship: Relationship is represented using diamonds shaped box.
E-R diagram
Prof. K. Adisesha
7
Different notations of E-R diagram:
Entity: An entity may be any object, class, person or place. In the ER diagram, an entity
can be represented as rectangles.
➢ Consider an organization as an example- manager, product, employee, department etc.
can be taken as an entity.
Weak Entity: An entity that depends on another entity called a weak entity. The weak
entity doesn't contain any key attribute of its own.
➢ The weak entity is represented by a double rectangle.
E-R diagram
Prof. K. Adisesha
8
Different notations of E-R diagram:
Attribute: The attribute is used to describe the property of an entity. Eclipse is used to
represent an attribute.
➢ For example, id, age, contact number, name, etc. can be attributes of a student.
➢ Different types of Attributes are:
❖ Key Attribute
❖ Composite Attribute
❖ Multivalued Attribute
❖ Derived Attribute
E-R diagram
Prof. K. Adisesha
9
Different notations of E-R diagram:
Key Attribute: The key attribute is used to represent the main characteristics of an entity. It
represents a primary key. The key attribute is represented by an ellipse with the text
underlined.
Composite Attribute: An attribute that composed of many other attributes is known as a
composite attribute. The composite attribute is represented by an ellipse, and those ellipses
are connected with an ellipse.
E-R diagram
Prof. K. Adisesha
10
Different notations of E-R diagram:
Multivalued Attribute: An attribute can have more than one value. These attributes are
known as a multivalued attribute. The double oval is used to represent multivalued
attribute.
➢ For example, a student can have more than one phone number.
Derived Attribute: An attribute that can be derived from other attribute is known as a
derived attribute. It can be represented by a dashed ellipse.
➢ For example, A person's age changes over time
and can be derived from another attribute like
Date of birth.
E-R diagram
Prof. K. Adisesha
11
Relationship:
A Relationship describes relations between entities. Relationship is represented using
diamonds shaped box.
➢ There are three types of relationship that exist between entities:
❖ Binary Relationship
❖ Recursive Relationship
❖ Ternary Relationship
E-R diagram
Prof. K. Adisesha
12
Binary Relationship:
It means relation between two entities.
➢ This is further divided into three types.
❖ One to One
❖ One to Many
❖ Many to Many
➢ One to One:
✓ This type of relationship is rarely seen in real world.
✓ The above example describes that one student can enroll only for one course and a
course will have only one Student. This is not what you will usually see in relationship.
E-R diagram
Prof. K. Adisesha
13
Binary Relationship:
➢ One to Many:
✓ It reflects business rule that one entity is associated with many number of same
entity.
✓ For example, Student enrolls for only one Course but a Course can have many
Students.
➢ Many to Many:
✓ It reflects business rule that many entity are associated with many number of same
entity.
✓ The above diagram represents that many students can enroll for more than one
course.
E-R diagram
Prof. K. Adisesha
14
Different notations of E-R diagram:
Database can be represented using the notations. In ER diagram, many notations are
used to express the cardinality.
➢ These notations are as follows:
Relational Keys
Prof. K. Adisesha
15
Keys used in database:
Keys play an important role in the relational database. It is used to uniquely identify any
record or row of data from the table.
➢ It is also used to establish and identify relationships between tables.
➢ Types of keys:
Relational Keys
Prof. K. Adisesha
16
Keys used in database:
➢ Primary key:
✓ It is a field in a table which uniquely identifies each row/record in a database table.
Primary keys must contain unique values.
✓ A primary key column cannot have NULL values.
✓ Ex: In the EMPLOYEE table, ID can be the primary key since it is unique for each
employee.
Relational Keys
Prof. K. Adisesha
17
Keys used in database:
➢ Candidate Key:
✓ When more than one or group of attributes serve as a unique identifier, they are
each called as candidate key.
✓ In the EMPLOYEE table, id is best suited for the primary key. The rest of the
attributes, like SSN, Passport_Number, License_Number, etc., are considered a
candidate key.
Relational Keys
Prof. K. Adisesha
18
Keys used in database:
➢ Super Key:
✓ Super key is an attribute set that can uniquely identify a tuple. A super key is a
superset of a candidate key.
✓ In the EMPLOYEE table, for(EMPLOEE_ID, EMPLOYEE_NAME), the name of
two employees can be the same, but their EMPLYEE_ID can't be the same. Hence,
this combination can also be a key.
Relational Keys
Prof. K. Adisesha
19
Keys used in database:
➢ Alternate Key:
✓ The alternate key of any table are those candidate keys, which are not currently
selected as the primary key. This is also known as secondary key.
✓ example, employee relation has two attributes, Employee_Id and PAN_No, that act
as candidate keys. In this relation, Employee_Id is chosen as the primary key, so the
other candidate key, PAN_No, acts as the Alternate key.
Relational Keys
Prof. K. Adisesha
20
Keys used in database:
➢ Foreign key:
✓ A key used to link two tables together is called a foreign key, also called as
referencing key.
✓ Foreign key is a field that matches the primary key column of another table.
✓ In the EMPLOYEE table, Department_Id is the foreign key, and both the tables are
related.
Relational Keys
Prof. K. Adisesha
21
Keys used in database:
➢ Composite key:
✓ Whenever a primary key consists of more than one attribute, it is known as a
composite key. This key is also known as Concatenated Key.
✓ in employee table, an employee may be assigned multiple roles, and an employee
may work on multiple projects simultaneously. So the primary key will be
composed of all three attributes, namely Emp_ID, Emp_role, and Proj_ID in
combination.
Integrity Constraints
Prof. K. Adisesha
22
Integrity Constraints:
Integrity constraints are pre-defined set of rules that are applied on the table
fields(columns) or relations to ensure that the overall validity, integrity, and consistency
of the data present in the database table is maintained.
➢ It is used to maintain the quality of information.
➢ It ensures that the data insertion, updating, and other processes have to be performed in
such a way that data integrity is not affected.
➢ Types of integrity constraints in relational data model:
❖ Domain Constraint
❖ Entity Constraint
❖ Referential Integrity Constraint
❖ Key Constraint
Integrity Constraints
Prof. K. Adisesha
23
Integrity Constraints Types:
Domain integrity constraint :
➢ Domain constraints can be defined as the definition of a valid set of values for an
attribute.
➢ The data type of domain includes string, character, integer, time, date, currency, etc.
The value of the attribute must be available in the corresponding domain.
ID NAME SEMESTER AGE
10001 PRAJWAL 2 19
10002 SUNNY 1 18
10003 SHAILU 3 A
Integrity Constraints
Prof. K. Adisesha
24
Integrity Constraints Types:
Entity integrity constraints:
➢ The entity integrity constraint states that primary key value can't be null.
➢ This is because the primary key value is used to identify individual rows in relation and
if the primary key has a null value, then we can't identify those rows.
➢ A table can contain a null value other than the primary key field.
ID NAME SEMESTER AGE
10001 PRAJWAL 2 19
10002 SUNNY 1 18
SHAILU 3 20
Integrity Constraints
Prof. K. Adisesha
25
Integrity Constraints Types:
Referential Integrity Constraints: A referential integrity constraint is specified between
two tables.
➢ In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary
Key of Table 2, then every value of the Foreign Key in Table 1 must be null or be
available in Table 2.
Integrity Constraints
Prof. K. Adisesha
26
Integrity Constraints Types:
Key constraints: Keys are the entity set that is used to identify an entity within its entity
set uniquely.
➢ An entity set can have multiple keys, but out of which one key will be the primary key.
A primary key can contain a unique and null value in the relational table..
ID NAME SEMESTER AGE
10001 PRAJWAL 2 19
10002 SUNNY 1 18
10002 SHAILU 3 20
Generalization
Prof. K. Adisesha
27
Generalization:
Generalization is a bottom-up approach in which two lower level entities combine to
form a higher level entity.
➢ In generalization, a number of entities are brought together into one generalized entity
based on their similar characteristics.
➢ For example, Student and Parent details can all be generalized as a group ‘Person’ as
Personal details.
Specialization
Prof. K. Adisesha
28
Specialization:
Specialization is a Top-down approach in which one higher level entity can be broken
down into two lower level entities.
➢ Specialization is the opposite of generalization.
➢ In specialization, a group of entities is divided into sub-groups based on their
characteristics.
➢ Take a group ‘Person’ for example. A person has name, date of birth, gender, etc.
Similarly, in a school database, persons can be specialized as teacher, student, or a staff,
based on what role they play in school as entities.
Aggregation
Prof. K. Adisesha
29
Aggregation:
In aggregation, the relation between two entities is treated as a single entity. In
aggregation, relationship with its corresponding entities is aggregated into a higher level
entity.
➢ Center entity offers the Course entity act as a single entity in the relationship which is in
a relationship with another entity visitor. If a visitor visits a coaching center then he will
enquiry about both Course and Center.
Aggregation
Prof. K. Adisesha
30
Aggregate function:
Aggregate functions in DBMS take multiple rows from the table and return a value
according to the query.
➢ Common aggregate functions include:
❖ Average (i.e., arithmetic mean)
❖ Count
❖ Maximum
❖ Median
❖ Minimum
❖ Mode
❖ Range
❖ Sum
ER diagram
Prof. K. Adisesha
31
Reduction of ER diagram to Table:
The database can be represented using the notations, and these notations can be reduced
to a collection of tables.
ER diagram
Prof. K. Adisesha
32
Reduction of ER diagram to Table:
Table structure for the given ER diagram is as below:
ER diagram
Prof. K. Adisesha
33
Reduction of ER diagram to Table:
Steps to convert Table structure from the given ER diagram is as below:
➢ Entity type becomes a table.
❖ In the given ER diagram, LECTURE, STUDENT, SUBJECT and COURSE forms
individual tables.
➢ All single-valued attribute becomes a column for the table.
❖ In the STUDENT entity, STUDENT_NAME and STUDENT_ID form the column of
STUDENT table. Similarly, COURSE_NAME and COURSE_ID form the column of
COURSE table and so on.
➢ A key attribute of the entity type represented by the primary key.
❖ In the given ER diagram, COURSE_ID, STUDENT_ID, SUBJECT_ID, and LECTURE_ID
are the key attribute of the entity.
ER diagram
Prof. K. Adisesha
34
Reduction of ER diagram to Table:
Steps to convert Table structure from the given ER diagram is as below:
➢ The multivalued attribute is represented by a separate table.
❖ In the student table, a hobby is a multivalued attribute. So it is not possible to represent
multiple values in a single column of STUDENT table. Hence we create a table
STUD_HOBBY with column name STUDENT_ID and HOBBY. Using both the column, we
create a composite key.
➢ Composite attribute represented by components.
❖ In the given ER diagram, student address is a composite attribute. It contains CITY, PIN,
DOOR#, STREET, and STATE. In the STUDENT table, these attributes can merge as an
individual column.
➢ Derived attributes are not considered in the table.
❖ In the STUDENT table, Age is the derived attribute. It can be calculated at any point of time
Relation Algebra
Prof. K. Adisesha
35
Relation Algebra:
Relational algebra is a procedural query language. It gives a step by step process to
obtain the result of the query. It uses operators to perform queries.
➢ Types of Relational operation:
Relation Algebra
Prof. K. Adisesha
36
Relation Algebra:
Relational algebra is a procedural query language that consists of a set of operations
that take one or more relations as input and result into a new relation as an output.
➢ The relational algebraic operations can be divided into:
❖ Basic set-oriented operations:
✓ Union, Set different, Cartesian product
❖ Relational-oriented operations:
✓ Selection, Projection, Division, Joins
Relation Algebra
Prof. K. Adisesha
37
Joins:
Joins in Database Management System are used in relational algebra and SQL to
join/combine more than one table to get some specific results out of those tables.
➢ A Join operation combines related tuples from different relations, if and only if a given
join condition is satisfied. It is denoted by ⋈.
➢ Different types of the JOINs in SQL:
❖ (INNER) JOIN
❖ LEFT (OUTER) JOIN
❖ RIGHT (OUTER) JOIN
❖ FULL (OUTER) JOIN
Relation Algebra
Prof. K. Adisesha
38
Joins:
Joins in Database Management System are used in relational algebra and SQL to
join/combine more than one table to get some specific results out of those tables.
➢ Different types of the JOINs in SQL:
❖ (INNER) JOIN: Returns records that have matching values in both tables
❖ LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from
the right table
❖ RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records
from the left table
❖ FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
Database Model
Prof. K. Adisesha
39
Normalization:
Normalization is a step by step process of removing the different kinds of redundancy
and anomaly one step at a time from the database.
➢ E.F Codd developed for the relation data model in 1970.
➢ Normalization rules are divided into following normal form:
Database Model
Prof. K. Adisesha
40
Normalization:
Normalization is a step by step process of removing the different kinds of redundancy
and anomaly one step at a time from the database.
Questions
Important Questions:
➢ Define the following database terms:
a. Data Model b. Tuple c. Domain d. Primary key e. Foreign key
➢ Write the difference between manual and electronic data processing.
➢ Explain any five applications of database.
➢ Briefly explain the data processing cycle.
➢ Write the difference between Hierarchical data model and network data model.
➢ What is normalization? Explain second normal form with an example.
➢ What is database model? Explain Hierarchical model.
➢ Explain 3-level DBMS architecture.
➢ .
Prof. K. Adisesha
41
Discussion
Prof. K. Adisesha (Ph. D)
42
Queries ?
Prof. K. Adisesha
9449081542

More Related Content

What's hot

Trees - Non Linear Data Structure
Trees - Non Linear Data StructureTrees - Non Linear Data Structure
Trees - Non Linear Data StructurePriyanka Rana
 
Normalization in SQL | Edureka
Normalization in SQL | EdurekaNormalization in SQL | Edureka
Normalization in SQL | EdurekaEdureka!
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization TechniquesNishant Munjal
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional DependencyRaj Naik
 
Advanced normalization - Bcnf
Advanced normalization - BcnfAdvanced normalization - Bcnf
Advanced normalization - Bcnflitpuvn
 
2 database system concepts and architecture
2 database system concepts and architecture2 database system concepts and architecture
2 database system concepts and architectureKumar
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalizationUniversity of Potsdam
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraintsNikhil Deswal
 
Normalisation student summary
Normalisation student summaryNormalisation student summary
Normalisation student summarymary_ramsay
 
Banco de Dados - Introdução - Projeto de Banco de Dados - DER
Banco de Dados - Introdução - Projeto de Banco de Dados - DERBanco de Dados - Introdução - Projeto de Banco de Dados - DER
Banco de Dados - Introdução - Projeto de Banco de Dados - DERRangel Javier
 
Entity Relationship Diagram part9
Entity Relationship Diagram part9Entity Relationship Diagram part9
Entity Relationship Diagram part9DrMohammed Qassim
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...Raj vardhan
 

What's hot (20)

Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Trees - Non Linear Data Structure
Trees - Non Linear Data StructureTrees - Non Linear Data Structure
Trees - Non Linear Data Structure
 
Normalization in SQL | Edureka
Normalization in SQL | EdurekaNormalization in SQL | Edureka
Normalization in SQL | Edureka
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization Techniques
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional Dependency
 
Advanced normalization - Bcnf
Advanced normalization - BcnfAdvanced normalization - Bcnf
Advanced normalization - Bcnf
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
2 database system concepts and architecture
2 database system concepts and architecture2 database system concepts and architecture
2 database system concepts and architecture
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraints
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Normalisation student summary
Normalisation student summaryNormalisation student summary
Normalisation student summary
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Banco de Dados - Introdução - Projeto de Banco de Dados - DER
Banco de Dados - Introdução - Projeto de Banco de Dados - DERBanco de Dados - Introdução - Projeto de Banco de Dados - DER
Banco de Dados - Introdução - Projeto de Banco de Dados - DER
 
Er diagram
Er diagramEr diagram
Er diagram
 
Data model and entity relationship
Data model and entity relationshipData model and entity relationship
Data model and entity relationship
 
Entity Relationship Diagram part9
Entity Relationship Diagram part9Entity Relationship Diagram part9
Entity Relationship Diagram part9
 
Normalisation
NormalisationNormalisation
Normalisation
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...
 

Similar to DBMS Part-2.pdf

Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Eddyzulham Mahluzydde
 
RELATIONSHIP IN DBMS.pptx
RELATIONSHIP IN DBMS.pptxRELATIONSHIP IN DBMS.pptx
RELATIONSHIP IN DBMS.pptxKAnurag2
 
Unit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdfUnit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdfMaryJacob24
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to databasePradnya Saval
 
Presentation of saad on e-r diagram.
Presentation of saad on e-r diagram.Presentation of saad on e-r diagram.
Presentation of saad on e-r diagram.sumit gyawali
 
Download different material from slide share
Download different material from slide shareDownload different material from slide share
Download different material from slide sharefanta teferi
 
Chapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxChapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxsantosh96234
 
Data Models & Introduction to UML
Data Models & Introduction to UML Data Models & Introduction to UML
Data Models & Introduction to UML نبيله نواز
 
DBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxDBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxsajinis5
 
Entity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxEntity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxsukrithlal008
 

Similar to DBMS Part-2.pdf (20)

DBMS unit-2.pdf
DBMS unit-2.pdfDBMS unit-2.pdf
DBMS unit-2.pdf
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1
 
DBMS Part-2.pptx
DBMS Part-2.pptxDBMS Part-2.pptx
DBMS Part-2.pptx
 
Data Models.pptx
Data Models.pptxData Models.pptx
Data Models.pptx
 
RELATIONSHIP IN DBMS.pptx
RELATIONSHIP IN DBMS.pptxRELATIONSHIP IN DBMS.pptx
RELATIONSHIP IN DBMS.pptx
 
Unit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdfUnit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdf
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
Data modeling
Data modelingData modeling
Data modeling
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
DATABASE DESIGN.pptx
DATABASE DESIGN.pptxDATABASE DESIGN.pptx
DATABASE DESIGN.pptx
 
rdbmsdol.pptx
rdbmsdol.pptxrdbmsdol.pptx
rdbmsdol.pptx
 
rdbmsdol.pptx
rdbmsdol.pptxrdbmsdol.pptx
rdbmsdol.pptx
 
Er model
Er modelEr model
Er model
 
er-models.pptx
er-models.pptxer-models.pptx
er-models.pptx
 
Presentation of saad on e-r diagram.
Presentation of saad on e-r diagram.Presentation of saad on e-r diagram.
Presentation of saad on e-r diagram.
 
Download different material from slide share
Download different material from slide shareDownload different material from slide share
Download different material from slide share
 
Chapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxChapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptx
 
Data Models & Introduction to UML
Data Models & Introduction to UML Data Models & Introduction to UML
Data Models & Introduction to UML
 
DBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxDBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptx
 
Entity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxEntity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptx
 

More from Prof. Dr. K. Adisesha

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfProf. Dr. K. Adisesha
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaProf. Dr. K. Adisesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfProf. Dr. K. Adisesha
 

More from Prof. Dr. K. Adisesha (20)

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdf
 
Introduction to Computers.pdf
Introduction to Computers.pdfIntroduction to Computers.pdf
Introduction to Computers.pdf
 
R_Programming.pdf
R_Programming.pdfR_Programming.pdf
R_Programming.pdf
 
Scholarship.pdf
Scholarship.pdfScholarship.pdf
Scholarship.pdf
 
Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
 
Operating System-1 by Adi.pdf
Operating System-1 by Adi.pdfOperating System-1 by Adi.pdf
Operating System-1 by Adi.pdf
 
Operating System-adi.pdf
Operating System-adi.pdfOperating System-adi.pdf
Operating System-adi.pdf
 
Data_structure using C-Adi.pdf
Data_structure using C-Adi.pdfData_structure using C-Adi.pdf
Data_structure using C-Adi.pdf
 
JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
 
JAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdfJAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdf
 

Recently uploaded

Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 

Recently uploaded (20)

Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 

DBMS Part-2.pdf

  • 2. Introduction E-R model Components E-R diagram Relation Algebra Relational Keys 2 Entity-Relationship model Prof. K. Adisesha Prof. K. Adisesha
  • 3. Introduction Prof. K. Adisesha 3 ER model: ER model stands for an Entity-Relationship model. It is a high-level data model. ➢ This model is used to define the data elements and relationship for a specified system. ➢ It develops a conceptual design for the database. It also develops a very simple and easy to design view of data. ➢ In ER modeling, the database structure is portrayed as a diagram called an entity- relationship diagram. ➢Example, Suppose we design a school database. In this database, the student will be an entity with attributes like address, name, id, age, etc.
  • 4. E-R diagram Prof. K. Adisesha 4 Components of E-R model: ER-Diagram is a visual representation of data that describes how data is related to each other. ➢ Entity ➢ Attribute ➢ Relationship
  • 5. E-R diagram Prof. K. Adisesha 5 Components of E-R model: ER-Diagram is a visual representation of data that describes how data is related to each other. Entity: ✓ An Entity can be any object, place, person or class. Attribute: ✓ An Attribute describes a property or characteristic of an entity. ✓ Example: Roll_No, Name and Birth date can be attributes of a student Relationship: ✓ A relationship type is a meaningful association between entity types. ✓ Relationship types are represented on the E-R diagram by a series of lines.
  • 6. E-R diagram Prof. K. Adisesha 6 Different notations of E-R diagram: ER-Diagram is a visual representation of data that describes how data is related to each other. ➢ Different notations of E-R diagram: ❖ Entity: An entity is represented using rectangles. ❖ Attribute: Attributes are represented by means of eclipses. ❖ Relationship: Relationship is represented using diamonds shaped box.
  • 7. E-R diagram Prof. K. Adisesha 7 Different notations of E-R diagram: Entity: An entity may be any object, class, person or place. In the ER diagram, an entity can be represented as rectangles. ➢ Consider an organization as an example- manager, product, employee, department etc. can be taken as an entity. Weak Entity: An entity that depends on another entity called a weak entity. The weak entity doesn't contain any key attribute of its own. ➢ The weak entity is represented by a double rectangle.
  • 8. E-R diagram Prof. K. Adisesha 8 Different notations of E-R diagram: Attribute: The attribute is used to describe the property of an entity. Eclipse is used to represent an attribute. ➢ For example, id, age, contact number, name, etc. can be attributes of a student. ➢ Different types of Attributes are: ❖ Key Attribute ❖ Composite Attribute ❖ Multivalued Attribute ❖ Derived Attribute
  • 9. E-R diagram Prof. K. Adisesha 9 Different notations of E-R diagram: Key Attribute: The key attribute is used to represent the main characteristics of an entity. It represents a primary key. The key attribute is represented by an ellipse with the text underlined. Composite Attribute: An attribute that composed of many other attributes is known as a composite attribute. The composite attribute is represented by an ellipse, and those ellipses are connected with an ellipse.
  • 10. E-R diagram Prof. K. Adisesha 10 Different notations of E-R diagram: Multivalued Attribute: An attribute can have more than one value. These attributes are known as a multivalued attribute. The double oval is used to represent multivalued attribute. ➢ For example, a student can have more than one phone number. Derived Attribute: An attribute that can be derived from other attribute is known as a derived attribute. It can be represented by a dashed ellipse. ➢ For example, A person's age changes over time and can be derived from another attribute like Date of birth.
  • 11. E-R diagram Prof. K. Adisesha 11 Relationship: A Relationship describes relations between entities. Relationship is represented using diamonds shaped box. ➢ There are three types of relationship that exist between entities: ❖ Binary Relationship ❖ Recursive Relationship ❖ Ternary Relationship
  • 12. E-R diagram Prof. K. Adisesha 12 Binary Relationship: It means relation between two entities. ➢ This is further divided into three types. ❖ One to One ❖ One to Many ❖ Many to Many ➢ One to One: ✓ This type of relationship is rarely seen in real world. ✓ The above example describes that one student can enroll only for one course and a course will have only one Student. This is not what you will usually see in relationship.
  • 13. E-R diagram Prof. K. Adisesha 13 Binary Relationship: ➢ One to Many: ✓ It reflects business rule that one entity is associated with many number of same entity. ✓ For example, Student enrolls for only one Course but a Course can have many Students. ➢ Many to Many: ✓ It reflects business rule that many entity are associated with many number of same entity. ✓ The above diagram represents that many students can enroll for more than one course.
  • 14. E-R diagram Prof. K. Adisesha 14 Different notations of E-R diagram: Database can be represented using the notations. In ER diagram, many notations are used to express the cardinality. ➢ These notations are as follows:
  • 15. Relational Keys Prof. K. Adisesha 15 Keys used in database: Keys play an important role in the relational database. It is used to uniquely identify any record or row of data from the table. ➢ It is also used to establish and identify relationships between tables. ➢ Types of keys:
  • 16. Relational Keys Prof. K. Adisesha 16 Keys used in database: ➢ Primary key: ✓ It is a field in a table which uniquely identifies each row/record in a database table. Primary keys must contain unique values. ✓ A primary key column cannot have NULL values. ✓ Ex: In the EMPLOYEE table, ID can be the primary key since it is unique for each employee.
  • 17. Relational Keys Prof. K. Adisesha 17 Keys used in database: ➢ Candidate Key: ✓ When more than one or group of attributes serve as a unique identifier, they are each called as candidate key. ✓ In the EMPLOYEE table, id is best suited for the primary key. The rest of the attributes, like SSN, Passport_Number, License_Number, etc., are considered a candidate key.
  • 18. Relational Keys Prof. K. Adisesha 18 Keys used in database: ➢ Super Key: ✓ Super key is an attribute set that can uniquely identify a tuple. A super key is a superset of a candidate key. ✓ In the EMPLOYEE table, for(EMPLOEE_ID, EMPLOYEE_NAME), the name of two employees can be the same, but their EMPLYEE_ID can't be the same. Hence, this combination can also be a key.
  • 19. Relational Keys Prof. K. Adisesha 19 Keys used in database: ➢ Alternate Key: ✓ The alternate key of any table are those candidate keys, which are not currently selected as the primary key. This is also known as secondary key. ✓ example, employee relation has two attributes, Employee_Id and PAN_No, that act as candidate keys. In this relation, Employee_Id is chosen as the primary key, so the other candidate key, PAN_No, acts as the Alternate key.
  • 20. Relational Keys Prof. K. Adisesha 20 Keys used in database: ➢ Foreign key: ✓ A key used to link two tables together is called a foreign key, also called as referencing key. ✓ Foreign key is a field that matches the primary key column of another table. ✓ In the EMPLOYEE table, Department_Id is the foreign key, and both the tables are related.
  • 21. Relational Keys Prof. K. Adisesha 21 Keys used in database: ➢ Composite key: ✓ Whenever a primary key consists of more than one attribute, it is known as a composite key. This key is also known as Concatenated Key. ✓ in employee table, an employee may be assigned multiple roles, and an employee may work on multiple projects simultaneously. So the primary key will be composed of all three attributes, namely Emp_ID, Emp_role, and Proj_ID in combination.
  • 22. Integrity Constraints Prof. K. Adisesha 22 Integrity Constraints: Integrity constraints are pre-defined set of rules that are applied on the table fields(columns) or relations to ensure that the overall validity, integrity, and consistency of the data present in the database table is maintained. ➢ It is used to maintain the quality of information. ➢ It ensures that the data insertion, updating, and other processes have to be performed in such a way that data integrity is not affected. ➢ Types of integrity constraints in relational data model: ❖ Domain Constraint ❖ Entity Constraint ❖ Referential Integrity Constraint ❖ Key Constraint
  • 23. Integrity Constraints Prof. K. Adisesha 23 Integrity Constraints Types: Domain integrity constraint : ➢ Domain constraints can be defined as the definition of a valid set of values for an attribute. ➢ The data type of domain includes string, character, integer, time, date, currency, etc. The value of the attribute must be available in the corresponding domain. ID NAME SEMESTER AGE 10001 PRAJWAL 2 19 10002 SUNNY 1 18 10003 SHAILU 3 A
  • 24. Integrity Constraints Prof. K. Adisesha 24 Integrity Constraints Types: Entity integrity constraints: ➢ The entity integrity constraint states that primary key value can't be null. ➢ This is because the primary key value is used to identify individual rows in relation and if the primary key has a null value, then we can't identify those rows. ➢ A table can contain a null value other than the primary key field. ID NAME SEMESTER AGE 10001 PRAJWAL 2 19 10002 SUNNY 1 18 SHAILU 3 20
  • 25. Integrity Constraints Prof. K. Adisesha 25 Integrity Constraints Types: Referential Integrity Constraints: A referential integrity constraint is specified between two tables. ➢ In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary Key of Table 2, then every value of the Foreign Key in Table 1 must be null or be available in Table 2.
  • 26. Integrity Constraints Prof. K. Adisesha 26 Integrity Constraints Types: Key constraints: Keys are the entity set that is used to identify an entity within its entity set uniquely. ➢ An entity set can have multiple keys, but out of which one key will be the primary key. A primary key can contain a unique and null value in the relational table.. ID NAME SEMESTER AGE 10001 PRAJWAL 2 19 10002 SUNNY 1 18 10002 SHAILU 3 20
  • 27. Generalization Prof. K. Adisesha 27 Generalization: Generalization is a bottom-up approach in which two lower level entities combine to form a higher level entity. ➢ In generalization, a number of entities are brought together into one generalized entity based on their similar characteristics. ➢ For example, Student and Parent details can all be generalized as a group ‘Person’ as Personal details.
  • 28. Specialization Prof. K. Adisesha 28 Specialization: Specialization is a Top-down approach in which one higher level entity can be broken down into two lower level entities. ➢ Specialization is the opposite of generalization. ➢ In specialization, a group of entities is divided into sub-groups based on their characteristics. ➢ Take a group ‘Person’ for example. A person has name, date of birth, gender, etc. Similarly, in a school database, persons can be specialized as teacher, student, or a staff, based on what role they play in school as entities.
  • 29. Aggregation Prof. K. Adisesha 29 Aggregation: In aggregation, the relation between two entities is treated as a single entity. In aggregation, relationship with its corresponding entities is aggregated into a higher level entity. ➢ Center entity offers the Course entity act as a single entity in the relationship which is in a relationship with another entity visitor. If a visitor visits a coaching center then he will enquiry about both Course and Center.
  • 30. Aggregation Prof. K. Adisesha 30 Aggregate function: Aggregate functions in DBMS take multiple rows from the table and return a value according to the query. ➢ Common aggregate functions include: ❖ Average (i.e., arithmetic mean) ❖ Count ❖ Maximum ❖ Median ❖ Minimum ❖ Mode ❖ Range ❖ Sum
  • 31. ER diagram Prof. K. Adisesha 31 Reduction of ER diagram to Table: The database can be represented using the notations, and these notations can be reduced to a collection of tables.
  • 32. ER diagram Prof. K. Adisesha 32 Reduction of ER diagram to Table: Table structure for the given ER diagram is as below:
  • 33. ER diagram Prof. K. Adisesha 33 Reduction of ER diagram to Table: Steps to convert Table structure from the given ER diagram is as below: ➢ Entity type becomes a table. ❖ In the given ER diagram, LECTURE, STUDENT, SUBJECT and COURSE forms individual tables. ➢ All single-valued attribute becomes a column for the table. ❖ In the STUDENT entity, STUDENT_NAME and STUDENT_ID form the column of STUDENT table. Similarly, COURSE_NAME and COURSE_ID form the column of COURSE table and so on. ➢ A key attribute of the entity type represented by the primary key. ❖ In the given ER diagram, COURSE_ID, STUDENT_ID, SUBJECT_ID, and LECTURE_ID are the key attribute of the entity.
  • 34. ER diagram Prof. K. Adisesha 34 Reduction of ER diagram to Table: Steps to convert Table structure from the given ER diagram is as below: ➢ The multivalued attribute is represented by a separate table. ❖ In the student table, a hobby is a multivalued attribute. So it is not possible to represent multiple values in a single column of STUDENT table. Hence we create a table STUD_HOBBY with column name STUDENT_ID and HOBBY. Using both the column, we create a composite key. ➢ Composite attribute represented by components. ❖ In the given ER diagram, student address is a composite attribute. It contains CITY, PIN, DOOR#, STREET, and STATE. In the STUDENT table, these attributes can merge as an individual column. ➢ Derived attributes are not considered in the table. ❖ In the STUDENT table, Age is the derived attribute. It can be calculated at any point of time
  • 35. Relation Algebra Prof. K. Adisesha 35 Relation Algebra: Relational algebra is a procedural query language. It gives a step by step process to obtain the result of the query. It uses operators to perform queries. ➢ Types of Relational operation:
  • 36. Relation Algebra Prof. K. Adisesha 36 Relation Algebra: Relational algebra is a procedural query language that consists of a set of operations that take one or more relations as input and result into a new relation as an output. ➢ The relational algebraic operations can be divided into: ❖ Basic set-oriented operations: ✓ Union, Set different, Cartesian product ❖ Relational-oriented operations: ✓ Selection, Projection, Division, Joins
  • 37. Relation Algebra Prof. K. Adisesha 37 Joins: Joins in Database Management System are used in relational algebra and SQL to join/combine more than one table to get some specific results out of those tables. ➢ A Join operation combines related tuples from different relations, if and only if a given join condition is satisfied. It is denoted by ⋈. ➢ Different types of the JOINs in SQL: ❖ (INNER) JOIN ❖ LEFT (OUTER) JOIN ❖ RIGHT (OUTER) JOIN ❖ FULL (OUTER) JOIN
  • 38. Relation Algebra Prof. K. Adisesha 38 Joins: Joins in Database Management System are used in relational algebra and SQL to join/combine more than one table to get some specific results out of those tables. ➢ Different types of the JOINs in SQL: ❖ (INNER) JOIN: Returns records that have matching values in both tables ❖ LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table ❖ RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table ❖ FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
  • 39. Database Model Prof. K. Adisesha 39 Normalization: Normalization is a step by step process of removing the different kinds of redundancy and anomaly one step at a time from the database. ➢ E.F Codd developed for the relation data model in 1970. ➢ Normalization rules are divided into following normal form:
  • 40. Database Model Prof. K. Adisesha 40 Normalization: Normalization is a step by step process of removing the different kinds of redundancy and anomaly one step at a time from the database.
  • 41. Questions Important Questions: ➢ Define the following database terms: a. Data Model b. Tuple c. Domain d. Primary key e. Foreign key ➢ Write the difference between manual and electronic data processing. ➢ Explain any five applications of database. ➢ Briefly explain the data processing cycle. ➢ Write the difference between Hierarchical data model and network data model. ➢ What is normalization? Explain second normal form with an example. ➢ What is database model? Explain Hierarchical model. ➢ Explain 3-level DBMS architecture. ➢ . Prof. K. Adisesha 41
  • 42. Discussion Prof. K. Adisesha (Ph. D) 42 Queries ? Prof. K. Adisesha 9449081542