Unit 2 DBMS
Unit 2 DBMS
What is ER Modeling?
A graphical technique for understanding and organizing the data independent of the actual database
implementation.
The entity-relationship data model perceives the real world as consisting of basic objects, called entities
and relationships among these objects.
Entity-relationship model describes data involves in real world in terms of object and their relationships.
It is widely used for initial database design. It describes overall structure of database. E-R model is in
fact, semantic data model which describes the meaning of data. It has a capability to map the meanings
and interactions of real world objects on to the conceptual schema.
Basic concepts:
The E-R data model employs the following basic notions : Entity, Entity sets, Relationship, Relationship
sets and Attributes.
Entity
It is a collection of objects.
An entity is an object that is distinguishable from other objects by a set of attributes.
This is the basic object of E-R Model, which is a 'thing' in the real world with an independent
existence.
An entity may be an 'object' with a physical existence.
Entities can be represented by 'Ellipses'.
Tangible Entity:
A tangible entity in database management is a physical object that can be touched, seen, or measured.
For example, a Customer in a database is a tangible entity because it is an actual object that can be
viewed and interacted with. Examples of tangible entities include cars, buildings, and people.
Intangible Entity:
An intangible entity in database management is a nonphysical object that cannot be touched, seen, or
measured. For example, a Account information is an intangible entity in database management because
it is not an actual object that can be viewed and interacted with. Intangible entities also include elements
like thoughts, emotions, and memories.
Entity set:
An entity set is a grouping of entities that share the same attributes. In other words, an entity set is a
group of distinct entities that have the same properties. For example, a customer entity might have the
name, address, and phone number attributes. A customer entity set would then be a group of customers
with those same attributes.
Entity sets are used to organize data in a database. By grouping objects with the same attributes
together, it becomes easier to query and manipulate the data. Additionally, separating different entity
sets prevents data from becoming cluttered and disorganized. For example, if all customer data is stored
in the same table as product data, it would be difficult to find specific information.
However, storing customer information in its own table makes it much easier to retrieve and work with
the data.
Attribute:
An entity is represented by a set of attributes. Attributes are descriptive properties possessed by each
member of an entity set.
BOOK is entity and its properties(calles as attributes) bookcode, booktitle, price etc…
An attribute as used in the E-R model , can be characterized by the following attribute types.
Simple and composite attribute:
simple attributes are the attributes which can’t be divided into sub parts. eg: customerid,empno etc…
composite attributes are the attributes which can be divided into subparts. eg: name consisting of first
name, middle name, last name and DOB(year,month, day), address consisting of city,pincode,state
Single-valued and multi-valued attribute:
The attribute having unique value is single –valued attribute eg: empno,customerid,regdno etc.
The attribute having more than one value is multi-valued attribute
eg: phone-no, dependent name, vehicle etc….
Derived Attribute:
The values for this type of attribute can be derived from the values of existing attributes
eg: age which can be derived from (currentdate-birthdate), experience_in_year can be calculated as
(currentdate-joindate) etc…
NULL valued attribute:
The attribute value which is unknown to user is called NULL valued attribute. For example, you might
want an attribute for a person's middle name, but you can't require a value because some people have no
middle name.
(Note: A variable of a given type has a particular value at a point in time. Thus, a programming
language variable corresponds to an entity in the E-R model.)
Domain of Attributes:
The set of possible values that an attribute can take is called the domain of the attribute. Every attribute
has a domain. A domain determines the type of data values that are permitted for that attribute, and thus
serves as an attribute constraint.
SQL provides a number of domain types to assign to attributes. The standard domain types include data
values for characters, numerals, currency, dates, times, and Boolean entries (a logical value of either true
or false).
Most RDBMSs also accept the BLOB (binary large object) domain type, which stores binary objects
such as graphics.
Choosing the correct domain type is critical to the accuracy of a database. It is important to choose the
right domain type for an attribute. For example, zip codes appear as numbers to us, so there is the
temptation to attach the numerical domain to them. However, zip codes in the northeastern section of the
United States begin with a zero. This would pose problems in a database since the numerical domain
drops leading zeros.
Enforcing domains
The RDBMS uses domain constraints to enforce attribute domains. When a user enters a data value, the
RDBMS checks to verify that the domain assigned to that attribute permits that value. For example, if a
user entered letters into a field with a currency domain(i.e numerals), that data entry would be rejected.
Likewise, a domain that accepted only dates would reject non-date entries. Additionally, most RDBMSs
reject impossible dates, such as February 30th.
Formally, if E1, E2, . . ,En (n≥2) are entity sets then a relationship set R is a subset of
{(e1,e2, . . ,en)│e1∈E1,e2 ∈E2, . . en ∈En}
where (e1,e2, . . ,en) is relationship.
ER Diagram Symbols and Notations
Types of Entity-relationship Diagrams