Entittes
Entittes
➢The Entity Relationship Model is a model for identifying entities to be represented in the
database and representation of how those entities are related. The ER data model specifies
enterprise schema that represents the overall logical structure of a database graphically.
➢Peter Chen developed the ER diagram in 1976. The ER model was created to provide a simple
and understandable model for representing the structure and logic of databases.
➢ER diagrams represent the E-R model in a database, making them easy to convert into relations
(tables).
➢ER diagrams provide the purpose of real-world modeling of objects which makes them intently
useful.
➢These diagrams are very easy to understand and easy to create even for a naive user.
• Lines: Lines represent attributes to entities and entity sets with other relationship types.
➢Simple attributes are widely used for storing information about the entity.
Composite Attribute
• When 2 or more than 2 simple attributes are combined to make an attribute then that attribute
is called a Composite attribute.
• The composite attribute is made up of multiple attributes. After combining these attributes,
the composed attributes are formed.
• Complex attributes are used where data is complex and needs to be stored in a complex
structure.
Single Valued Attribute
• The attribute with only a single value is known as a single-valued
attribute. These attributes have a single value for each instance of a
given entity.
• Mostly these attributes are used to provide the unique identity to the
multiple instances of attributes.
Multivalued Attribute
➢An attribute which can have multiple values is known as
a multivalued attribute. Multivalued attributes have multiple values
for the single instance of an entity.
➢Key of entity is associated with multiple values. It does not have only
one value. It is the opposite of the single-valued attribute.
Key Attribute
➢The attribute which has unique values for every row in the table is
known as a Key Attribute. The key attribute has a very crucial role in
the database.
➢ NOT NULL: This constraint tells that we cannot store a null value in a column. That is, if a column is specified
as NOT NULL then we will not be able to store null in this particular column any more.
➢ UNIQUE: This constraint when specified with a column, tells that all the values in the column must be unique.
That is, the values in any row of a column must not be repeated.
➢ PRIMARY KEY: A primary key is a field which can uniquely identify each row in a table. And this constraint
is used to specify a field in a table as primary key.
➢ FOREIGN KEY: A Foreign key is a field which can uniquely identify each row in a another table. And this
constraint is used to specify a field as Foreign key.
➢ CHECK: This constraint helps to validate the values of a column to meet a particular condition. That is, it helps
to ensure that the value stored in a column meets a specific condition.
➢ DEFAULT: This constraint specifies a default value for the column when no value is specified by the user.
➢Sub class:
A subclass is a class derived from the superclass. It inherits the properties
of the superclass and also contains attributes of its own.
➢Super class:
A superclass is the class from which many subclasses can be created, The
subclasses inherit the characteristics of a superclass. The superclass is also known
as the parent class or base class.
Example of super class and sub class
Inheritance
➢Inheritance is basically the process of basing a class on another class i.e to build a class on a
existing class. The new class contains all the features and functionalities of the old class in
addition to its own.
➢Inheritance in DBMS allow us to create a relationship between tables,
➢It enables us to establish a hierarchical structure among tables , where child table inherit
attributes and behaviours from their parent table .
➢This help to reduce redundancy , improve data integrity and simplify queries.
Generalization and Specialization are two essential ideas used to describe the hierarchical connections
between things in a database in the context of Enhanced Entity-Relationship (EER) diagrams.
Generalization:
Generalization is a bottom-up method used to combine lower-level entities into a higher-level object. This
approach creates a more generic entity, known as a superclass, by combining entities with similar features. By
removing duplication and arranging the data in a more organized manner, generalization streamlines the data
model.
Advantages of Generalization
➢ Cuts Down on Redundancy: Cuts down on data duplication by combining related entities into a single entity.
➢ Enhances Data Organization: By cohesively presenting related entities, it makes better organization possible.
Disadvantages of Generalization
➢ Loss of Specificity: The generic entity may take center stage over the distinctive qualities of lower-level entities.
➢ Complexity of Querying: As data becomes more abstracted, queries may get more complicated.
Specialization
specialization is a top-down method where a higher-level entity is split into two or more
lower-level entities according to their distinct qualities.
This technique, which includes splitting a single entity set into subgroups, is often
connected to inheritance, in which attributes from the higher-level entity are passed down to the
lower-level entities.
Advantages of Specialization
• Enhances Specificity: By forming specialized subgroups, it is possible to depict things in
more depth.
• Enhances Data Integrity: Makes certain that every entity have distinct qualities relevant to
its area of expertise.
Disadvantages of Specialization