0% found this document useful (0 votes)
2 views4 pages

DBMS

The document explains the concept of entities in databases, distinguishing between strong and weak entities, and outlines the various types of attributes associated with them. It also describes relationships between entities, including one-to-one, one-to-many, many-to-one, and many-to-many relationships, along with the structure of an Entity Relationship Diagram (ER Diagram). Additionally, it covers different types of keys in a relational database model, such as candidate keys, primary keys, super keys, alternate keys, and foreign keys.

Uploaded by

amaldavis2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

DBMS

The document explains the concept of entities in databases, distinguishing between strong and weak entities, and outlines the various types of attributes associated with them. It also describes relationships between entities, including one-to-one, one-to-many, many-to-one, and many-to-many relationships, along with the structure of an Entity Relationship Diagram (ER Diagram). Additionally, it covers different types of keys in a relational database model, such as candidate keys, primary keys, super keys, alternate keys, and foreign keys.

Uploaded by

amaldavis2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MODULE II

→entity
An entity is a piece of data that is stored in the database. An entity can be a person, place,
thing, or even an event. There are two types of entities in DBMS: strong and weak.
ER diagram is created based on three principal components:
1.Entities-strong entity & weak entity.
Strong entity:For example, in a Database for a company's employees, the "Employee" Entity
can be considered a strong Entity Type.It will be the main part of that data.It is represented by a
single rectangle.
Weak Entity: For example,in a database for a car, colour of the car is not an important
thing.That type of not important but it is a part of that data is called weak entity.The weak entity
is represented by a double rectangle.
2.Attributes
An entity can have one or more attributes, which are properties or characteristics that describe
the entity. For example, a customer can have attributes such as name, email, phone no and
address.
● Simple Attributes-it is an independent attribute.it doesn't have subdivisions or any other
classifications.eg:roll no,reg no.
● Composite Attributes-it has division or classifications.eg:name-fname mname lname.
● Single Valued Attributes-accept only one value.eg:roll no,age
● Multi-Valued Attributes-an attribute that can have more than one value associated with
the key of the entity.eg:a customer can have more than one phone no.
● Derived Attributes-are those attributes whose values can be derived from the values of
other attributes.eg:From DOB, we can derive the Age attribute, which changes every
year, and can easily calculate the age.
● Complex Attributes -(Rarely used attributes)They are formed by the combination of
multi-valued and composite attributes.eg:address is a composite attribute and phone no
is a multivalued attribute then,the complex attribute will be address_phone no.
● Key Attributes -Key attributes are special types of attributes that act as the primary key
for an entity and they can uniquely identify an entity from an entity set.eg:Roll_no of a
student will always be unique to identify the student.
● Stored Attributes-Values of stored attributes remain constant and fixed for an entity
instance and also, and they help in deriving the derived attributes.eg:the Age attribute
can be derived from the Date of Birth attribute, and also, the Date of birth attribute has a
fixed and constant value throughout the life of an entity. Hence, the Date of Birth attribute
is a stored attribute.

3.Relationships
It depicts the relationship between two entities.The diamond shape showcases a relationship in
the ER diagram.
● One-to-One Relationships-When a single element of an entity is associated with a single
element of another entity, it is called a one-to-one relationship.
Eg: a student has only one identification card and an identification card is given to one

person.
● One-to-Many Relationships-When a single element of an entity is associated with more
than one element of another entity.eg:a customer can place many orders, but an order

cannot be placed by many customers.


● Many-to-One Relationships-When more than one element of an entity is related to a
single element of another entity.eg:students have to opt for a single course, but a course

can have many students.


● Many-to-Many Relationships-When more than one element of an entity is associated
with more than one element of another entity.eg:you can assign an employee to many

projects and a project can have many employees.

→entity relationship diagram


describes the structure of a database with the help of a diagram, which is known as Entity
Relationship Diagram (ER Diagram).
Symbols for creating an ER diagram

Eg:ER diagram of student


→Types of Keys (Candidate, Super, Primary, Alternate and Foreign)
Keys are one of the basic requirements of a relational database model. It is widely used to
identify the tuples(rows) uniquely in the table.
1.Candidate Key
The minimal set of attributes that can uniquely identify a tuple is known as a candidate key. For
Example, STUD_NO in STUDENT relation.
● It is a minimal super key.
● It is a super key with no repeated data is called a candidate key.
● It must contain unique values.
● It can contain NULL values.
● Every table must have at least a single candidate key.
● A table can have multiple candidate keys but only one primary key.
2.Primary Key
There can be more than one candidate key in relation out of which one can be chosen as the
primary key. For Example, STUD_NO, as well as STUD_PHONE, are candidate keys for
relation STUDENT but STUD_NO can be chosen as the primary key (only one out of many
candidate keys).
● It is a unique key.
● It can identify only one tuple (a record) at a time.
● It has no duplicate values, it has unique values.
● It cannot be NULL.
● Primary keys are not necessarily to be a single column; more than one column can also
be a primary key for a table.
3.super Key
A super key is a group of single or multiple keys that identifies rows in a table.
For Example, STUD_NO, (STUD_NO, STUD_NAME), etc.
● Adding zero or more attributes to the candidate key generates the super key.
● A candidate key is a super key but vice versa is not true.
● Super Key values may also be NULL.
4.Alternate Key
The candidate key other than the primary key is called an alternate key.
● All the keys which are not primary keys are called alternate keys.
● It is a secondary key.
● It contains two or more fields to identify two or more records.
● These values are repeated.
● Eg:- SNAME, and ADDRESS is Alternate keys.
5.Foreign Key
an attribute can only take the values which are present as values of some other attribute, it will
be a foreign key to the attribute to which it refers.
● It is a key it acts as a primary key in one table and it acts as
● secondary key in another table.
● It combines two or more relations (tables) at a time.
● They act as a cross-reference between the tables.
● For example, DNO is a primary key in the DEPT table and a non-key in EMP.

You might also like