The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions

Database-Management-Systems---10CS54-VTU-notes-->View question

Asked On2018-09-05 14:48:34 by:anonymous

Taged users:

Be first to like this question

Be first to dislike this question
Talk about this  Like  Dislike
View all qusetions

The entity relationship (ER) data model has existed for over 35 years. It is well suited to data modelling for use with databases because it is fairly abstract and is easy to discuss and explain. ER models are readily translated to relations. ER models, also called an ER schema, are represented by ER diagrams.

ER modelling is based on two concepts:

  • Entities, defined as tables that hold specific information (data)
  • Relationships, defined as the associations or interactions between entities
  • For the rest of this chapter, we will use a sample database called the COMPANY database to illustrate the concepts of the ER model. This database contains information about employees, departments and projects. Important points to note include:

    • There are several departments in the company. Each department has a unique identification, a name, location of the office and a particular employee who manages the department.
    • A department controls a number of projects, each of which has a unique name, a unique number and a budget.
    • Each employee has a name, identification number, address, salary and birthdate. An employee is assigned to one department but can join in several projects. We need to record the start date of the employee in each project. We also need to know the direct supervisor of each employee.
    • We want to keep track of the dependents for each employee. Each dependent has a name, birthdate and relationship with the employee.

    Entity, Entity Set and Entity Type

    An entity is an object in the real world with an independent existence that can be differentiated from other objects. An entity might be

    • An object with physical existence (e.g., a lecturer, a student, a car)
    • An object with conceptual existence (e.g., a course, a job, a position)

    Entities can be classified based on their strength. An entity is considered weak if its tables are existence dependent.

    • That is, it cannot exist without a relationship with another entity
    • Its primary key is derived from the primary key of the parent entity
      • The Spouse table, in the COMPANY database, is a weak entity because its primary key is dependent on the Employee table. Without a corresponding employee record, the spouse record would not exist.

    An entity is considered strong if it can exist apart from all of its related entities.

    • Kernels are strong entities.
    • A table without a foreign key or a table that contains a foreign key that can contain nulls is a strong entity
    • Another term to know is entity type which defines a collection of similar entities.

      An entity set is a collection of entities of an entity type at a particular point of time. In an entity relationship diagram (ERD), an entity type is represented by a name in a box. For example, in Figure 8.1, the entity type is EMPLOYEE.

      An entity’s existence is dependent on the existence of the related entity. It is existence-dependent if it has a mandatory foreign key (i.e., a foreign key attribute that cannot be null). For example, in the COMPANY database, a Spouse entity is existence -dependent on the Employee entity.

      Kinds of Entities

      You should also be familiar with different kinds of entities including independent entities, dependent entities and characteristic entities. These are described below.

      Independent entities

      Independent entities, also referred to as kernels, are the backbone of the database. They are what other tables are based on. Kernels have the following characteristics:

      • They are the building blocks of a database.
      • The primary key may be simple or composite.
      • The primary key is not a foreign key.
      • They do not depend on another entity for their existence.

      If we refer back to our COMPANY database, examples of an independent entity include the Customer table, Employee table or Product table.

      Dependent entities

      Dependent entities, also referred to as derived entities, depend on other tables for their meaning. These entities have the following characteristics:

      • Dependent entities are used to connect two kernels together.
      • They are said to be existence dependent on two or more tables.
      • Many to many relationships become associative tables with at least two foreign keys.
      • They may contain other attributes.
      • The foreign key identifies each associated table.
      • There are three options for the primary key:
        1. Use a composite of foreign keys of associated tables if unique
        2. Use a composite of foreign keys and a qualifying column
        3. Create a new simple primary key

      Characteristic entities

      Characteristic entities provide more information about another table. These entities have the following characteristics:

      • They represent multivalued attributes.
      • They describe other entities.
      • They typically have a one to many relationship.
      • The foreign key is used to further identify the characterized table.
      • Options for primary key are as follows:
        1. Use a composite of foreign key plus a qualifying column
        2. Create a new simple primary key. In the COMPANY database, these might include:
          • Employee (EID, Name, Address, Age, Salary) – EID is the simple primary key.
          • EmployeePhone (EID, Phone) – EID is part of a composite primary key. Here, EID is also a foreign key.


      Each entity is described by a set of attributes (e.g., Employee = (Name, Address, Birthdate (Age), Salary).

      Each attribute has a name, and is associated with an entity and a domain of legal values. However, the information about attribute domain is not presented on the ERD.

      In the entity relationship diagram, shown in Figure 8.2, each attribute is represented by an oval with a name inside.

      Figure 8.2. How attributes are represented in an ERD.

      Types of Attributes

      There are a few types of attributes you need to be familiar with. Some of these are to be left as is, but some need to be adjusted to facilitate representation in the relational model. This first section will discuss the types of attributes. Later on we will discuss fixing the attributes to fit correctly into the relational model.

      Simple attributes

      Simple attributes are those drawn from the atomic value domains; they are also called single-valued attributes. In the COMPANY database, an example of this would be: Name = {John} ; Age = {23}

      Composite attributes

      Composite attributes are those that consist of a hierarchy of attributes. Using our database example, and shown in Figure 8.3, Address may consist of Number, Street and Suburb. So this would be written as → Address = {59 + ‘Meek Street’ + ‘Kingsford’}

      An important constraint on an entity is the key. The key is an attribute or a group of attributes whose values can be used to uniquely identify an individual entity in an entity set.

      Types of Keys

      There are several types of keys. These are described below.

      Candidate key

      candidate key is a simple or composite key that is unique and minimal.  It is unique because no two rows in a table may have the same value at any time. It is minimal because every column is necessary in order to attain uniqueness.

      From our COMPANY database example, if the entity is Employee(EID, First Name, Last Name, SIN, Address, Phone, BirthDate, Salary, DepartmentID), possible candidate keys are:

      • EID, SIN
      • First Name and Last Name – assuming there is no one else in the company with the same name
      • Last Name and DepartmentID – assuming two people with the same last name don’t work in the same department

      Composite key

      composite key is composed of two or more attributes, but it must be minimal.

      Using the example from the candidate key section, possible composite keys are:

      • First Name and Last Name – assuming there is no one else in the company with the same name
      • Last Name and Department ID – assuming two people with the same last name don’t work in the same department

      Primary key

      The primary key is a candidate key that is selected by the database designer to be used as an identifying mechanism for the whole entity set. It must uniquely identify tuples in a table and not be null. The primary key is indicated in the ER model by underlining the attribute.

      • A candidate key is selected by the designer to uniquely identify tuples in a table. It must not be null.
      • A key is chosen by the database designer to be used as an identifying mechanism for the whole entity set.  This is referred to as the primary key. This key is indicated by underlining the attribute in the ER model.

      In the following example, EID is the primary key:

      Employee(EID, First Name, Last Name, SIN, Address, Phone, BirthDate, Salary, DepartmentID)

      Secondary key

      secondary key is an attribute used strictly for retrieval purposes (can be composite), for example: Phone and Last Name.

      Alternate key

      Alternate keys are all candidate keys not chosen as the primary key.

      Foreign key

      A foreign key (FK) is an attribute in a table that references the primary key in another table OR it can be null. Both foreign and primary keys must be of the same data type.

      In the COMPANY database example below, DepartmentID is the foreign key:

      Employee(EID, First Name, Last Name, SIN, Address, Phone, BirthDate, Salary, DepartmentID)


      A null is a special symbol, independent of data type, which means either unknown or inapplicable. It does not mean zero or blank. Features of null include:

      • No data entry
      • Not permitted in the primary key
      • Should be avoided in other attributes
      • Can represent
        • An unknown attribute value
        • A known, but missing, attribute value
        • A “not applicable” condition
      • Can create problems when functions such as COUNT, AVERAGE and SUM are used
      • Can create logical problems when relational tables are linked

      NOTE: The result of a comparison operation is null when either argument is null. The result of an arithmetic operation is null when either argument is null (except functions that ignore nulls).

      Example of how null can be used

      Use the Salary table (Salary_tbl) in Figure 8.6 to follow an example of how null can be used.

      To begin, find all employees (emp#) in Sales (under the jobName column) whose salary plus commission are greater than 30,000.

      • SELECT emp# FROM Salary_tbl
      • WHERE  jobName = Sales AND
      • (commission + salary) > 30,000  –> E10 and E12

      This result does not include E13 because of the null value in  the commission column. To ensure that the row with the null value is included, we need to look at the individual fields. By adding commission and salary for employee E13, the result will be a null value. The solution is shown below.

      • SELECT emp# FROM Salary_tbl
      • WHERE jobName = Sales AND
      • (commission > 30000 OR
      • salary > 30000 OR
      • (commission + salary) > 30,000  –>E10 and E12 and E13


      Relationships are the glue that holds the tables together. They are used to connect related information between tables.

      Relationship strength is based on how the primary key of a related entity is defined. A weak, or non-identifying, relationship exists if the primary key of the related entity does not contain a primary key component of the parent entity. Company database examples include:

      A strong, or identifying, relationship exists when the primary key of the related entity contains the primary key component of the parent entity. Examples include:

      Below are descriptions of the various types of relationships.

      One to many (1:M) relationship

      A one to many (1:M) relationship should be the norm in any relational database design and is found in all relational database environments. For example, one department has many employees. Figure 8.7 shows the relationship of one of these employees to the department.

      One to one (1:1) relationship

      A one to one (1:1) relationship is the relationship of one entity to only one other entity, and vice versa. It should be rare in any relational database design. In fact, it could indicate that two entities actually belong in the same table.

      An example from the COMPANY database is one employee is associated with one spouse, and one spouse is associated with one employee.

      Many to many (M:N) relationships

      For a many to many relationship, consider the following points:

      • It cannot be implemented as such in the relational model.
      • It can be changed into two 1:M relationships.
      • It can be implemented by breaking up to produce a set of 1:M relationships.
      • It involves the implementation of a composite entity.
      • Creates two or more 1:M relationships.
      • The composite entity table must contain at least the primary keys of the original tables.
      • The linking table contains multiple occurrences of the foreign key values.
      • Additional attributes may be assigned as needed.
      • It can avoid problems inherent in an M:N relationship by creating a composite entity or bridge entity. For example, an employee can work on many projects OR a project can have many employees working on it, depending on the business rules. Or, a student can have many classes and a class can hold many students

Answerd on:2019-05-14 Answerd By:rishabhshukla


Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video over here

Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.
Answer a question: You can answer the questions not yet answered in eduladder.How to answer a question
Career: Work or do your internship with us.Work with us
Create a video: You can teach anything and everything each video should be less than five minutes should cover the idea less than five min.How to upload a video on eduladder