Professional Documents
Culture Documents
4 All Keys
4 All Keys
were:
1. Generalization
2. Specialization
3. Aggregration
Generalization is the process of extracting shared characteristics from two or more
classes, and combining them into a generalized superclass. Shared characteristics can be
attributes, associations, or methods.specialization means creating new subclasses from
an existing class. If it turns out that certain attributes, associations, or methods only
apply to some of the objects of the class, a subclass can be created.
Generalization
Generalization is the result of taking the union of two or more disjoint(lower-level)
entity sets to produce a higher-level entity-set.
Generalization is the process of extracting common properties from a set of entities and
create a generalized entity from it.
The higher level entity can also combine with other lower level entities to make further
higher level entity.
It's more like Superclass and Subclass system, but the only difference is the approach,
which is bottom-up. Hence, entities are combined to form a more generalised entity, in
other words, sub-classes are combined to form a super-class.
For example, Saving and Current account types entities can be generalised and an entity
with name Account can be created, which covers both.
Specialization
Specialization is opposite to Generalization. Specialization is a process in which an entity
is divided into sub-entities based on their characteristics.
In specialization, a higher level entity may not have any lower-level entity sets, it's
possible.
In addition to sharing the attributes of the higher-level entity, these lower-level entities
have specific attributes of their own.
The following enhanced entity relationship diagram expresses the entities in a
hierarchical database to demonstrate specialization:
In the diagram above, the relationship between Center and Course together, is acting as
an Entity, which is in relationship with another entity Visitor. Now in real world, if a
Visitor or a Student visits a Coaching Center, he/she will never enquire about the center
only or just about the course, rather he/she will ask enquire about both
For Example, Employee working for a project may require some machinery. So,
REQUIRE relationship is needed between relationship WORKS_FOR and entity
MACHINERY. Using aggregation, WORKS_FOR relationship with its entities EMPLOYEE
and PROJECT is aggregated into single entity and relationship REQUIRE is created
between aggregated entity and MACHINERY.
keys in DBMS:
Key plays an important role in relational database; it is used for identifying unique rows
from table. It also establishes relationship among tables.
Types of keys in DBMS
Primary Key – A primary key is a column or set of columns in a table that uniquely
identifies tuples (rows) in that table selected by the admin(DBA)
Super Key – A super key is a set of one of more columns (attributes) to uniquely identify
rows in a table.
Candidate Key – A super key with no redundant attribute is known as candidate key
Alternate Key – Out of all candidate keys, only one gets selected as primary key,
remaining keys are known as alternate or secondary keys.
Composite Key – A key that consists of more than one attribute to uniquely identify rows
(also known as records & tuples) in a table is called composite key.
Foreign Key – Foreign keys are the columns of a table that points to the primary key of
another table. They act as a cross-reference between tables.
Primary Key: Any one of the candidate keys can be a Primary key that is choosen by the
DBA(Database Administrator) or admin of the database.
Alternate Key: Excluding the Primary key all other candidate keys are called alternate
key of the table(entity),’Student’.
Foreign key: If a primary key (for example S_roll of ‘Student ‘ entity) is a reference key of
any other table or entity in order to manipulate(such as retrieval of information)the
information of database,then the key is called Foreign key of later(2nd) table referred
by 1st table(here ‘Student’ table).