Thursday, November 3, 2016

ER MODEL

Before define ER Model, there are some terms which is require to understand ER model properly. In short, ER Model is a diagrammatic representation of entire Database tables. It represents a High Level Database Design.
For Designing the Softwares : This phase is done in softwares by UML (Unified Modelling Language).
For Designing the Database : ER Model is used to design database.

Definitions :

Entity : an object (Record in the table). It a a real world object, such as person, place, thing, event, or concept about which information is recorded. For example, In a banking environment, entities are CUSTOMERS, BANK SUPPLIERS etc. Entities may be –
  • Physical – Can be touched(sensed) Example Fan.
  • Conceptual – Cannot be touched. Example course offered, brand name etc.
Storing conceptual entities is a big problem.
Entity Types : is defined as a collection of entities that have the same attributes. For example, employee in a company database. As same attributes are shared by the employee entities, but such entity has its own value for each attributes.

Entity Set : Collection of similar entities of same type that share the same attribute at any point in time. For example, a Faculty set may contain all the teachers of a college, Set of all persons, Set of Companies etc. The Entity Set is also called extension of the Entity Type.
Attribute : It is the name of the column. An attribute gives the characteristics of the entity.  It is also called as data element, data field, a field, a data item, or an elementary item.
Some examples of Attributes which clear the concept of attributes –
a) A house can be described by its colour, size and surroundings 
b) A bank account can be described by its bank account number, account 
   type, account balance, account statement etc.
c) A customer of bank may be described by : name, address, customer ID 
   number, phone number.

So, in example a) colour, size and surroundings are attributes of entity 
   "HOUSE".
    In example b) account number, type, balance and statement are 
    attributes of entity "ACCOUNT"
    In example c) name address ID number and phone number are attributes 
    of entity "CUSTOMER"
Data Value : It is the actual data or information contained in each data element(attribute). The data element “Supplier Name” can take value as “Anil Mittal”

Difference between Entity, Attributes, and Data Values –

ENTITYATTRIBUTES(OR DATA ELEMENTS)VALUES
CUSTOMERCustomer ID Number
Customer Name
Customer Address
Customer Phone Number
985678
Ankit Mittal
B-176,MC Colony, Bhiwani
57845-69821
ACCOUNTAccount Type
Account Number
Account Balance
Account Statement
Savings
1800221133665587
125000
5000_Credit
SUPPLIERSupplier Name
Supplier Address
Supplier Phone Number
Supplier Bill Number
Vishal Rastogi
H-456, Shiv Nagar, Bhiwani
789546256
B-896541

Difference Between Entity, Entity Type and Entity Sets – 

EntityEntity TypeEntity Set
Entity is a person, place, thing, event, or even a concept. It may be tangible or intangible.An entity type defines the collection of entities that have the same attributes.An entity set is a set of entities of the same type that share the same properties at any point in time (or) It is the collection of entities of an entity type at a point of time.
For Example, Entity is e1 or e2 or e3 or an apple
where e1 e2 e3 are employees
and an apple is a fruit.
For example, entity type is EMPLOYEE or FruitEntity set is a bucket of apple, banana, mango etc. or {e1,e2……}
Example :
Entity TypeEmployee
AttributesName, Age, Pay
Entity Set
(extension)
e1
(Rakesh, 40, 10000)
e2
(Arun, 55, 8500)
e3
(Sandeep, 30, 14000) 

Notations Of above Definitions in ER Diagram –

Entity-1(ER Model)Entity Type
entity set(ER Model)Entity Set
Attribute(ER Model)Attribute

Types of Relationships in ER Diagram

Different types of relationships in er diagram are – 1) Relationships based on degree, 2) Recursive Relationship. Let us discuss these one by one.

Relationship and Relationship Set :  

Relationships connect the entities and represent meaningful dependencies between them.It represents an association among several entities.
Relationships sets is a set of relationships of the same type. It is a mathematical relation on entity sets (n>=2). Relationship set R is a subset of –
{(r1,r2,r3,....rn)| r1∈E1, r2∈E2, rn∈En}
where r1,r2,….rn are called relationships and E1,E2,….En are entity sets.
The way in which two or more entity types are related is called relation type.For example, consider a relationship type WORKS_FOR between the two entity types EMPLOYEE and DEPARTMENT, which associates or links each employee with the department the employee works for.
The WORKS_FOR relation type is shown as –
relationship set example-Types of Relationships in ER Diagram


Binary Relationship-Types of Relationships in ER Diagram
In the above figure, each instance of relation type WORKS_FOR i.e.(r1, r2,…,r5) is connected to instances of employee and department entities. Employee e1, e2 and e5 work for department  d2 and employee e3 and e4 work for department d1.

Notation to Represent Relation Type in ER Diagram-

Relation types are represented as diamond shaped boxes.
Relarionship Notation (Types of Relationships in ER Diagram)

Degree of a Relationship Type-

The number of participating entity types is known as the degree of relationship type.

Types of Relationship Type Based on Degree –

  • Binary Relationship – A relationship type of degree two is called binary relationship. The WORKS_FOR in above figure is a binary relationship as  there are two participating entities-employee and department.
    Binary Relationship-Types of Relationships in ER Diagram
  • Ternary Relationship- A relationship type of degree three is a ternary relationship for example, in the below figure supply relationship connects three entities SUPPLIER, PART AND PROJECT.
    Ternary Relationship-Types of Relationships in ER Diagram
    The above diagram can be read as – a supplier supplies the parts to projects
  • N-ary Relationship Set – A relationship type of degree n is called n ary relationship . For example
N-Array Relationship Set

Role Names-

A relationship type has a name which signifies what role a participating entity plays in that relationship instance. The role names helps to explain what the  relationship means.
In the first example WORKS_FOR  relationship type, employee plays the role of worker and department plays the role of employee(because a department consists of a number of employees.

Recursive  Relationship

If the same entity type participate more than once in a  relationship type in different roles then such  relationship types are called recursive  relationship. For example, in the below figure REPORTS_TO is a recursive relationship as the Employee entity type plays two roles – 1) Supervisor and 2) Subordinate.
Recursive Relationship -types of relationships in er diagram
You can also define the above example of recursive relationship as the relationship between a manager and an employee. An employee is a manager as well as employee.
recursive relationship - employee and manager
This is commonly know as a ‘pig’s ear’.
To implement recursive relationship, a foreign key of the employee’s manager number would be held in each employee record.
Emp_entity( Emp_no,Emp_Fname, Emp_Lname, Emp_DOB, Emp_NI_Number, Manager_no);

Manager no - (this is the employee no of the employee's manager)
Another more Complicated Example of Recursive Relationship :
Relationship between a person and their parents :
recursive relationship between a person and parents

Relationship Constraints in DBMS –

There are three Types of Relationship Constraints-
  1. Structural Constraints
    •  Participation Constraints
    • Cardinality Ratio
  2. Overlap Constraints
  3. Covering Constraints
Structural Constraints are applicable for binary relationships and
Overlap and Covering Constraints are applicable for EERD(Extended ER Diagrams).

Participation (or) Optionality Constraints-

Participation concerns with the involvement of entities in a relationship. It specifies whether the existence of an entity depends on another entity. There are two types of Participation Constraints –
  1. Total/Mandatory Participation
  2. Partial/Optional Participation

Notations of Different Types of Participation In ER Diagram –

Participation Notations-Relationship Constraints in DBMS
Total/Mandatory Participation or Existence Dependency-
Participation is said to be total if every entity in E participates in atleast one relationship in R (or) every entity in entity set must depend on another entity. For example, every department will have a startup date as a department was created on that startup date (SINCE ATTRIBUTE of MANAGE relationship). and that department is being handled from that date through a Manager. So, the participation of DEPARTMENT entity in the “MANAGE” relationship type is total.
Total Participation is also known as Existence Dependency.
In ER Diagram, it is represented as a Double Line, connecting the participating entity to the relationship.
Partial/Optional Participation-
Participation is said to be partial if only some entities in E participate in relationships in R (or) some entities in entity set are depend on some another entities in entity set. For example, It is not necessary that all employees manage some department Because all employees may not be the Manager . So the participation of “EMPLOYEE” entity in the “MANAGES” relationship type is partial.
Participation Example-Relationship Constraints in DBMS
                            (Figure-1)

Cardinality/Mapping Cardinality-

Cardinality expresses the number of entities to which another entity can be associated via a relationship set (or)
It specifies the number of relationship instances that an entity can participate in a relation set.
There are 4 types of Cardinality Ratios :
  • One-to-One Cardinality (1:1)
  • One-to-Many Cardinality (1:m)
  • Many-to-One Cardinality (m:1)
  • Many-to-Many Cardinality (m:n)

Notations of Different Types of Cardinality In ER Diagram –

Cardinality Notations-Relationship Constraints in DBMS
One-to-One Cardinality (1:1) –
An entity in set A is associated with atmost one entity in B, and an entity in B is associated with atmost one entity in A. This type of cardinality is referred as one to one Cardinality.
For example, an Employee as a  Manager manage only one Department  and the vice versa is also true as a department have only one Manager
One to One Cardinality Example-Relationship Constraints in DBMS
One to one Cardinality-Relationship Constraints in DBMS

Create Table MANAGE
( SSN varchar(10),
  DNO varchar(15),
  Primary key(SSN),
  Foreign Key(SSN) .........,
  Foreign Key(DNO) .........,
);
Candidate Keys of "MANAGE" relationship - SSN,DNO
One to Many Cardinality (1:M) –
An entity in A is associated with any number (0 or more) with an entity B, but a entity in B, however can be associated with atmost one entity in A. For example, An employee as a Manager can manage more than one Department.
one to many Cardinality Example -Relationship Constraints in DBMS
Create Table MANAGE
( SSN varchar(10),
  DNO varchar(15),
  SINCE date,
  Primary key(DNO),
  Foreign Key(SSN) .........,
  Foreign Key(DNO) .........,
);
Candidate Keys of "MANAGE" relationship - DNO
Many to One Cardinality (M:1) –
An entity in A is associated with atmost one entity in B. An entity in B, however, can be associated with any number (0 or more) of entities in A. For example, An Employee can work only for one Department, But each Department can have 0 or more employees.
Many to One Cardinality Example-Relationship Constraints in DBMS
Create Table WORKS_ON
( SSN varchar(10),
  DNO varchar(15),
  SINCE date,
  Primary key(SSN),
  Foreign Key(SSN) .........,
  Foreign Key(DNO) .........,
);
Candidate Keys of "WORKS_ON" relationship - SSN
Many to Many Cardinality (M:N) –
An entity in A is associated with any number (0 or more) of entities in B, and an entity in B is associated with any number( 0 or more) of entities in A. For example, An Employee can works on several Projects and a Project may have several Employees.
Many to Many Cardinality Example-Relationship Constraints in DBMS
Create Table WORKS_ON
( SSN varchar(10),
  DNO varchar(15),
  SINCE date,
  Primary key(SSN,DNO),
  Foreign Key(SSN) .........,
  Foreign Key(DNO) .........,
);
Candidate Keys of "WORKS_ON" relationship - SSN PID

Some Points regarding Cardinality and Participation –

1. Minimum Cardinality = 0, for partial participation and equal to 1 for 
   total participation.
2. Maximum Cardinality = n, if one entity occurrence relates to multiple
   entity occurrences.
3. Minimum Cardinality give partial or total participation.
4. Maximum Cardinality give the maximum number of entities that is related
   to.


Constraints and cardinality - Relationship Constraints in DBMS

Relation Between Cardinality and Joins

Cardinality means it is a relation between tables using joins which tells that how many rows of one table will match with rows in other tables when these tables are joined.
In other words Relationships between the tables define Cardinality while explaining how each table links to the other.

Example :

Consider the two tables Consumer(custID) and Bill(BID, FK_custID). Each consumer pays the electricity bill every month. So, a customer will be associated with 12 bills after one year. It means there is one to many relationship between consumer and the bills he paid.  In this case, the cardinality is defined from primary key of the Customer table(PK_Custid) to the foreign key (FK_Custid) of the Bill table.
The number of same rows in both the tables depends upon which join is used.


Complete ER diagram


Let us create a simple ER diagram for a STUDENT database. What is the requirement of this database?
‘Student attends class. Each class is divided into one or more sections. Each class will have its own specified subjects. Students have to attend all the subjects of the class that he attends’.
Now let us identify what are the entities? STUDENT, CLASS, SECTION, SUBJECT are the entities. Attributes of these entities are not specified here. But we know what could be the entities of each of the entities. We can list them as below at this point of time.
STUDENTCLASSSECTIONSUBJECT
STUDENT_IDCLASS_IDSECTION_IDSUBJECT_ID
STUDENT_NAMECLASS_NAMESECTION_NAMESUBJECT_NAME
ADDRESS
DOB
AGE
CLASS_ID
SECTION_ID
What are the relationships we have? ‘Attends’, ‘has section’, ‘have subjects’ and ‘studies subjects’ are the relations here. With this knowledge of requirement, we can draw the ER diagram as below.
Observe the diagram carefully. Did we miss or drew it correctly? Are we missing anything on the diagram? Is it inferring correct requirement? What are our observations?
  • Age attribute can be derived from DOB. Hence we have to draw dashed oval.
  • Address is a composite attribute. We have to draw its sub attributes too. So that we will be very clear about his address details.
  • If we see the SECTION entity, by section id, will we be able get the section that student attends? There is no relation mentioned between Student and Section. But Section is mapped only with Class. What do we understand from this? Section is a weak entity. Hence we have to represent it properly.
  • If we look at ‘attends’ relationship between STUDENT and CLASS, we can have ‘Joining Date’ and ‘Total Number of Hours’ attributes. But it is an attribute of relation. We have to show them in the diagram.
  • Since each class is having different subjects and Students attends those subjects, we can modify the relation ‘studies’ to ‘has’ relation on the relation ‘attends’.
Now the diagram will change to reflect all above points.
Are done with complete diagram? We have not added the cardinality and participation in the diagram.
What are the participation constraints here?
  • All the Students attend any one of the class, but class can have only certain group of students. Hence total participation of Students and partial participation of class in ‘Attends’ relation.
  • All the class has section and all the section has class. Hence both are total participation.
  • All the Students study some of the subjects specific for their class and each class has only some group of subjects. Hence partial participation of both STUDENT and CLASS. Each subject will be studied by some students and it will be part of some class. Hence this also partial participation.
What are the cardinalities of all the relationship?
  • Each Student attends only one class at a time. Hence it is a 1: 1 relation.
  • Each class has one or more sections. Hence it can be considered as 1: N relation.
  • Each student attends many subjects and each class has many subjects. Hence it is a 1:N relation.
Note: If you look at STUDENT and CLASS relationship as many Students attend one class, then it would be an M: 1 relation. It is all up to the developer, how he looks at the requirement.
Now it is a complete ER diagram for simple Student database.

Codd's Rule

Codd's Rule

E.F Codd was a Computer Scientist who invented Relational model for Database management. Based on relational model, Relation database was created. Codd proposed 13 rules popularly known as Codd's 12 rules to test DBMS's concept against his relational model. Codd's rule actualy define what quality a DBMS requires in order to become a Relational Database Management System(RDBMS). Till now, there is hardly any commercial product that follows all the 13 Codd's rules. Even Oracle follows only eight and half out(8.5) of 13. The Codd's 12 rules are as follows.

Rule zero

This rule states that for a system to qualify as an RDBMS, it must be able to manage database entirely through the relational capabilities.

Rule 1 : Information rule

All information(including metadata) is to be represented as stored data in cells of tables. The rows and columns have to be strictly unordered.

Rule 2 : Guaranted Access

Each unique piece of data(atomic value) should be accesible by : Table Name + primary key(Row) + Attribute(column).
NOTE : Ability to directly access via POINTER is a violation of this rule.

Rule 3 : Systemetic treatment of NULL

Null has several meanings, it can mean missing data, not applicable or no value. It should be handled consistently. Primary key must not be null. Expression on NULL must give null.

Rule 4 : Active Online Catalog

Database dictionary(catalog) must have description of Database. Catalog to be governed by same rule as rest of the database. The same query language to be used on catalog as on application database.

Rule 5 : Powerful language

One well defined language must be there to provide all manners of access to data. Example: SQL. If a file supporting table can be accessed by any manner except SQL interface, then its a violation to this rule.

Rule 6 : View Updation rule

All view that are theoretically updatable should be updatable by the system.

Rule 7 : Relational Level Operation

There must be Insert, Delete, Update operations at each level of relations. Set operation like Union, Intersection and minus should also be supported.

Rule 8 : Physical Data Independence

The physical storage of data should not matter to the system. If say, some file supporting table were renamed or moved from one disk to another, it should not effect the application.

Rule 9 : Logical Data Independence

If there is change in the logical structure(table structures) of the database the user view of data should not change. Say, if a table is split into two tables, a new view should give result as the join of the two tables. This rule is most difficult to satisfy.

Rule 10 : Integrity Independence

The database should be able to conforce its own integrity rather than using other programs. Key and Check constraints, trigger etc should be stored in Data Dictionary. This also make RDBMS independent of front-end.

Rule 11 : Distribution Independence

A database should work properly regardless of its distribution across a network. This lays foundation of distributed database.

Rule 12 : Nonsubversion rule

If low level access is allowed to a system it should not be able to subvert or bypass integrity rule to change data. This can be achieved by some sort of looking or encryption.

Components of ER Diagram

ER-Diagram is a visual representation of data that describes how data is related to each other.


Symbols and Notations



Components of E-R Diagram

The E-R diagram has three main components.

1) Entity

An Entity can be any object, place, person or class. In E-R Diagram, an entity is represented using rectangles. Consider an example of an Organisation. Employee, Manager, Department, Product and many more can be taken as entities from an Organisation.
                                      

Weak Entity

Weak entity is an entity that depends on another entity. Weak entity doen't have key attribute of their own. Double rectangle represents weak entity.


2) Attribute

An Attribute describes a property or characterstic of an entity. For example, Name, Age, Address etc can be attributes of a Student. An attribute is represented using eclipse.


Key Attribute

Key attribute represents the main characterstic of an Entity. It is used to represent Primary key. Ellipse with underlying lines represent Key Attribute.


Composite Attribute

An attribute can also have their own attributes. These attributes are known as Composite attribute.


3) Relationship

A Relationship describes relations between entities. Relationship is represented using diamonds.

There are three types of relationship that exist between Entities.
  • Binary Relationship
  • Recursive Relationship
  • Ternary Relationship

Binary Relationship

Binary Relationship means relation between two Entities. This is further divided into three types.
  1. 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 also have only one Student. This is not what you will usually see in relationship.
  2. One to Many : It reflects business rule that one entity is associated with many number of same entity. The example for this relation might sound a little weird, but this menas that one student can enroll to many courses, but one course will have one Student.
    The arrows in the diagram describes that one student can enroll for only one course.
  3. Many to One : It reflects business rule that many entities can be associated with just one entity. For example, Student enrolls for only one Course but a Course can have many Students.
  4. Many to Many :
    The above diagram represents that many students can enroll for more than one courses.

Recursive Relationship

When an Entity is related with itself it is known as Recursive Relationship.


Ternary Relationship

Relationship of degree three is called Ternary relationship.

Data Models in DBMS

Data Model in DBMS

A model is an abstraction process that represent essential features without including the background details or explanations. It hides superfluous details while highlighting details pertinent to the application at hand.
A data model is a mechanism that provides this abstraction for database applications. Data modelling is used for representing entities of  interest and their relationships in the data base.
A data model defines the logical structure of a data base means that how data is connected to each other and how they are processed and stored inside a system.

A number of models for representing data have been developed. As with programming languages, there is no best choice for all applications but the models maintains the integrity of the by enforcing a set of constraints.
Data models differ in their method of representing the associations amongst entities and attributes. The main models or approach are:
Click on these models to know more .

Data Model Structure and Constraints –

  • To define the database structure, Constructs are used
  • Constructs typically include elements (and their data types) as well as group of elements (Example- Entity, Record, Table), and relationships among such groups.
  • Constraints specify some restriction on valid data; These constraints must be enforced at all times.

Data Model Operations –

These operations are used for specifying database retrievals and updates by referring to constructs of the data model. The Operations may include basic model operations as well as user defined operations.

Basic Model Operations :
  • Insert
  • Delete
  • Update
User Defined Operations Example :
  • compute_student_CGPA
  • compute_student_marks
  • compute_student_SGPA
  • update_inventory etc.
The hierarchical model is the oldest DBMS model and the object oriented DBMS being the newest data model.

Entity and Its Types

Entity and its Types – Strong Entity, Weak Entity, Composite Entity

Entity – 

An entity is an object that are represented in the database. For example Mohit, Vasu, CSE306 etc.
An entity is represented or defined by set of attributes. Attributes are the properties used to describe an entity. For example, a STUDENT entity may have a Name, Roll number, Class, Marks etc. where STUDENT is the entity and name roll number class marks are the attributes.

Types of Entity – 

  1. Strong Entity Types
  2. Recursive Entity Types
  3. Weak Entity Types
  4. Composite Entity Types or Associative Entity Types
  5. SuperType and SubType Entities

Notations Of different Entity Type in ER Diagram 

 Entity-2(entity and its types)Entity
Strong Entity Type(Entity and its Types)Strong Entity Type
weak entity type-1(entity and its types)Weak Entity Type
Recursive Entity Set(entity and its types)Recursive Entity Type
Composite or Associative Entity(entity and its types)Composite Entity Type (or)
Associative Entity
 Subtypes and supertypes-Entity and its Types Subtypes and Supertypes

Strong Entity Type – are the entities which has a key attribute in its attribute list or a set that has a primary key. The strong entity type is also called regular entity type. For Example,
Strong Entity Type(Entity and its Types)

The Student’s unique RollNo will identify the students. So, RollNo is set to be the Primary Key of the STUDENT entity, & Hence STUDENT is a strong entity type because of its key attribute.
Recursive Entity Type – It is also called Self Referential Relationship Entity Type. It is an entity type with foreign key referencing to same table or itself. Recursive Entity Type occurs in a unary relationship.
For example, a supervisor and subordinate relationship sets – One Supervisor can supervise multiple subordinates but each subordinate reporting to atmost one supervisor.
Recursive Entity Set(Entity and its Types)

In example b) An employee supervises another employee. Let the employee who supervises another one is manager. So, Manager supervises employees. But a manager is also an employee, whose details are in the employee entity. So, to implement this, a foreign key of the employee’s manager number would be held in each employee record i.e “supssn”.
So, the employee entity will contain its attributes as –
  • Employee ID (subssn)
  • Employee FirstName
  • Employee Lastname
  • Employee DateofBirth
  • and Manager Number (i.e. employee number of the employee’s manager) – (supssn)
The next figure will clear you the employee entity as a recursive entity –
Recursive Entity example(Entity and its Types)
If M:M ==> Reports_To(supssn,subssn)
then 2 tables are made.
Weak Entity Type –

weak entity type(entity and its types)
Entity Type with no key or Primary Key are called weak entity Type.
The Tuples of weak entity type may not be possible to differentiate using one attribute of weak entity.For every weak entity, there should be unique OWNER entity type. In the below example, CHILD is a WEAK entity type and Employee is the OWNER entity type.
Example of weak entity type is –
weak entity type(entity and its types)
Children Entity is depending upon Strong Entity Employee(as it has a unique ID named SSN). The relationship is established to associate children with their parents for insurance coverage.
Attributes of CHILDREN entity are-
  • CNAME (name of Child)
  • Age of Child
  • Type of Insurance
So, None of the attributes of CHILDREN does not give a unique ID to the entity. And the CHILDREN Entity has to depend on EMPLOYEE entity for identification.
The next table will clear you the child entity as a weak entity and so is represented with employee id(SSN) –
SSNCNAMEAGEGENDER
E1A8M
E2A10M
E1B10F
E3B10F
CHILD_BELONGS_TO(SSN,CNAME,AGE,GENDER)
Maximum number of tables = 2
Minimum number of tables = 2
Some Points about weak entity Type –
1) Weak entity Type should always combines with weak relationship set for 
   database schema relation.
 
2) Relationship between OWNER ENTITY Type and Weak Entity Type is also 
   partial. 

3) Participation between weak entity Type and relationship is always TOTAL

4) Cardinality can be Many to Many or One to Many.
Composite Entities –
If a Many to Many relationship exist then we must eliminate it by using composite entities. Composite Entities are the entities which exists as a relationship as well as an entity. The many to many relationship will be converted to 1 to many relationship.
Composite Entities are also called Bridge Entities, because they acts like a bridge between the two entities which have many to many relationship.
Bridge or Composite entity composed of the primary keys of each of the entities to be connected.
A composite entity is represented by a diamond shape with in a rectangle in an ER Diagram.

Supertypes and Subtypes Entities –
A subtype is a subprouping of the entities in an entity type that is meaningful to the organisation. For example, In a University, a STUDENT is an entity type. Two subtypes of STUDENT entity are
  • GRADUATE STUDENT
  • UNDERGRADUATE STUDENT
A supertype is a generic entity type that has a relationship with one or more sub-types. In the above example, STUDENT entity is a supertype.