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

STUDENT (Entity Type)

The document defines several key concepts in entity-relationship modeling: 1. An entity is a real-world object that can be uniquely identified, such as a person, car, company, or job. Entities have attributes that describe their properties. 2. An entity type is a collection of entities that share the same attributes. Examples given are students, teachers, classes, and courses in a school database. 3. An entity set is a collection of entities of the same type. For example, a student entity set would contain all students in a school. 4. Relationships define associations between entity types, such as a student enrolling in a course. Relationship types have cardinalities that

Uploaded by

Eiksha Suneja
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
165 views

STUDENT (Entity Type)

The document defines several key concepts in entity-relationship modeling: 1. An entity is a real-world object that can be uniquely identified, such as a person, car, company, or job. Entities have attributes that describe their properties. 2. An entity type is a collection of entities that share the same attributes. Examples given are students, teachers, classes, and courses in a school database. 3. An entity set is a collection of entities of the same type. For example, a student entity set would contain all students in a school. 4. Relationships define associations between entity types, such as a student enrolling in a course. Relationship types have cardinalities that

Uploaded by

Eiksha Suneja
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Entity:-

An entity is a real-world object ,that can be easily identifiable. It is a thing in real world with an
independent existence. An entity may be and object with a physical existence(for example, a person,
car etc) or it may be a object with conceptual existence(a company, a job etc).

Roll no S_name Age City

1 Rohit 20 Faridabad Entity

2 Aman 22 Delhi

EntityType:-

A collection of entities which share same attributes is known as Entity Type. An Entity Type in DB
is described by its name and attributes.In a database, we would be grouping only related data
together and storing them under one group name called Entity Type. This helps in identifying which
data is stored where and under what name. It reduces the time to search for a particular data in a
whole database. For example, in a school database, students, teachers, classes, and courses offered
can be considered as entity type. All these entity type have some attributes or properties that give
them their identity. Entity Type is represented in ER Diagram by Rectangle. For example-

STUDENT(entity type)

Roll no S_name Age City

Entity Set:-

An entity set is a collection of entities of same entity type. An entity set may contain entities with
attribute sharing similar values. For example, a Students set may contain all the students of a school;
likewise a Teachers set may contain all the teachers of a school from all faculties. Entity sets need
not be disjoint.
Attribute :-

Entities are represented by means of their properties, called attributes.Inabove example, student
entity type have attribute like rollno, s_name, age and city .It's also known as columns of the table.
An oval shape is used to represent the attributes. Name of the attribute is written inside the oval
shape and is connected to its entity type by a line.

Type of Attributes:-An attribute can have single value or multiple value or range of values. In
addition, each attribute can contain certain type of data like only numeric value, or only alphabets,
or combination of both, or date or negative or positive values etc. Depending on the values that an
attribute can take, it is divided into different types.There exists a domain or range of values that
can be assigned to attributes. For example, a student's name cannot be a numeric value. It has to be
alphabetic. A student's age cannot be negative, etc.

Simple Attribute

These kinds of attributes have values which cannot be divided further. For example, STUDENT_ID
attribute which cannot be divided further. Passport Number is unique value and it cannot be divided.
Simple attributes are representation as:-

Composite Attribute

This kind of attribute can be divided further to more than one simple attribute. For example, address
of a person. Here address can be further divided as Door#, street, city, state and pin which are simple
attributes.
Derived Attribute

Derived attributes are attributes that do not exist in the physical database, but their values are derived
from other attributes presentinentity type. For example, Age of a person can be obtained from date
of birth and current date. Average salary, annual salary, total marks of a student etc are few
examples of derived attribute.

Stored Attribute

The attribute which gives the value to get the derived attribute are called Stored Attribute. In
example above, age is derived using Date of Birth. Hence Date of Birth is a stored attribute.

Single Valued Attribute

These attributes will have only one value. For example, EMPLOYEE_ID, passport#, driving
license#, SSN etc have only single value for a person.

Multi-Valued Attribute
[Type a
quote
These attribute can have more than one value at any point of time. Manager can have more thantheone
from
employee working for him, a person can have more than one email address, and moredocumen than one
t or the
house etc is the examples.
summary
of an
interesti
ng point.
You can
position
the text
box
anywher
e in the
Relationship:-The association among entities is called a relationship. For example, an
employee works_at a department, a student enrolls in a course. Here, Works_at and Enrolls are
called relationships. A relationship between two entity type is represented by diamond shape.

EMPLOYEE DEPARTMENT

Relationship type:- A relationship type R among N entity types E1,E2,E3En


defines a set of association among entities from these entity types. Each of entity type
E1, E2En is said to participate in the relationship type R through relationship
instances or associations r1,r2,r3.rn .

RelationshipSet:-A set of relationships of similar type is called a relationship set.

Relationship degree:- The degree of a relationship type is the number of participation entity
types. For example if Work_For a relationship type between EMPLOYEE and DEPARTMENT
entity types then the degree of Work-for relationship type is 2. A relationship type of degree two is
called as Binary and a relationship type of degree three is called as Ternary. For example
Roles names:- Each entity type that participates in a Relationship type plays a particular roles in
the relationship. The role name defines the role that a participating entity from the entity type plays
in each relationship instance. For example in the Work_For relationship type , EMPLOYEE plyas
the role of workers and DEPARTMENT plays the role of employer.

Roles names are not very important in the relationship type where all the participating
entity types are different and each participating entity type name can be used as role
name. But in some cases same entity type is participates more than once in a
relationship type in different roles. In such cases role names become important and
essential.

Recursive relationship:- When same entity type is participates more than once in a
relationship type in different roles then these type of relationship is called as
Recursive Relationship.

Mapping Cardinalities :-

Cardinality defines the number of entities in one entity set, which can be associated with the
number of entities of other set via relationship set.
One-to-one One entity from entity set A can be associated with at most one entity of entity
set B and vice versa.

One-to-many One entity from entity set A can be associated with more than one entities of
entity set B however an entity from entity set B, can be associated with at most one entity.

Many-to-one More than one entities from entity set A can be associated with at most one
entity of entity set B, however an entity from entity set B can be associated with more than
one entity from entity set A.
Many-to-many One entity from A can be associated with more than one entity from B and
vice versa.

Keys:-

Keys are the attributes of the entity, which uniquely identifies the record of the entity type. For
example STUDENT_ID identifies individual students, passport#, license # etc.

Super Key A set of attributes (one or more) that collectively identifies an entities in an
entity set.
Candidate Key A minimal super key is called a candidate key. An entity set may have
more than one candidate key.Candidate key is a super key from which you cannot remove
any fields.
Primary Key A primary key is one of the candidate keys chosen by the database designer
to uniquely identify the entity set.

Important features of primary key:-

We denote the primary key by underlining the column name.


The value of primary key should be unique for each row of the table. Primary key column
cannot contain duplicate values.
Primary key column should not contain nulls.

For example:-

Roll no name age Passport no address

1 Rahul 22 12345 Delhi

2 Geeta 20 null Faridabad


3 Raman 20 23456 Gurgaon
4 Rahul 23 45678 Faridabad

In the above table

Super key can be:-(roll no), (passport no) ,(rollno,age),(rollno,age,name),(passport no,roll no),
(passport no,age) , (name, age), (roll no, name, age, passport no, address) etc..

Candidate key are :- (roll no), (passport no), (name, age), (name , address), (age, address).

Primary key cab be:- ( roll no), (name, age), (name, address), (age, address)

Foreign Key:-A foreign key is a column or group of columns in a relational database table that
provides a link between data in two tables. the foreign key is defined in a second table, but it refersto
the primary key in the first table. For example, say we have two tables, a CUSTOMER table that
includes all customer data, and an ORDERS table that includes all customer orders. Business logic
requires that all orders must be associated with a customer that is already in the CUSTOMER table.
To present this logic, we place a foreign key on the ORDERS table that refer the primary key of
the CUSTOMER table. This way, we can ensure that all orders in the ORDERS table are related to a
customer in the CUSTOMER table. In other words, the ORDERS table cannot contain information
on a customer that is not in the CUSTOMER table.

CUSTOMER ORDER
SID NAME PHONE CITY ORDER_ID NAME SID
NO

Here SID in ORDER table act as foreign key as it refer the primary key(SID) of
COUSTOMERtable. The table containing the foreign key is called the referencing or child table,
and the table containing the primary key is called the referenced or parent table

Types of Entity:-

Strong Entity: Entities having its own attribute as primary keys are called strong entity. For
example, STUDENT has STUDENT_ID as primary key. Hence it is a strong entity.
Weak Entity: Entities which cannot form their own attribute as primary key are known weak
entities. These entities will derive their primary keys from the combination of its attribute and
primary key from its mapping entity.

Consider CLASS and SECTION entity. The SECTION has SECTION _ID and NAME as its
attribute. But SECTION _ID alone cannot be a primary key, since it fails to tell for which course it
is related to. We will not be uniquely identifying the course section by this attribute alone. But if
this attribute along with CLASS_ID gives the meaning for each section and we can uniquely
identify the sections.

Composite Entity: Entities participating in the many to many relationships are called
composite entity. In this case, apart from two entities that are part of relation, we will one
more hidden entity in the relation. We will be creating a new entity with the relation, and
create a primary key by using the primary keys of other two entities.

Consider the example, multiple students enrolled for multiple courses. In this case, we create
STUDENT and COURSE. Then we create one more table for the relation Enrolment and name it
as STUD_COURSE. Add the primary keys of COURSE and STUDENT into it, which forms the
composite primary key of the new table.

Recursive Entity: If a relation exists between the same entities, then such entities are called
as recursive entity. For example, mapping between manager and employee is recursive entity.
Here manager is mapped to the same entity Employee. HOD of the department is another
example of having recursive entity.

You might also like