DBMS Unit 1 Notes
DBMS Unit 1 Notes
UNIT-I
1.1Introduction
Applications of Traditional Database
In everyday life we are doing several activities that involve some interaction with a
database.
Even purchasing items at a supermarket often automatically updates the database that
holds the inventory of grocery items.All these activities will involve some computer program
accessing a database. The above mentioned examples are comes under Traditional database
applications.
Traditional database applications, in which most of the information that is stored and
accessed is either textual or numeric.
Databases play a critical role in almost all areas where computers are used, including
business, electronic commerce, engineering, medicine, genetics, law, education, and library
science.
1. Multimedia databases (store images, audio clips, and video streams digitally)
2. Geographic information systems (GIS) can store and analyze maps, weather data, and
satellite images.
3. Datawarehouses and online analytical processing (OLAP) systems are used in many
companies to extract and analyze useful business information from very large databases
to support decision making.
4. Real-time and active database technology is used to control industrial and manufacturing
processes.
5. Database search techniques are applied by World Wide Web search engines (to improve
the search for information that is needed by users browsing the Internet).
DATA:Data means facts that can be recorded and that have implicit meaning.
Eg. In olden days, Phone book or indexed address book which contains the names,
telephone numbers, and addresses of the people we know, is nothing but data.
The same data we might have stored it on a hard drive, using a personal computer and
software such as Microsoft Access or Excel.
Today’s phone which allows us to store ph.no., mail id’s, address etc.
(Here we use the word data for both singular and plural. In standard English for plural –
data, singular - datum )
Information
• Processed data is called information
• The purpose of data processing is to generate the information required for carrying out the
business activities.
(The preceding definition of database is quite general; for example, we may consider the
collection of words that make up this page of text to be related data and hence to constitute a
database. However, the common use of the term database is usually more restricted. )
1.A database represents some aspect of the real world, sometimes called the miniworld or the
universe of discourse (UoD). Changes to the miniworld are reflected in the database.(If a
person’s phone number changed means it should update in my phone database)
2.A database is a logically coherent (interrelated) collection of data with some inherentmeaning.
A random collection of data cannot be said to as a database.(In a library, Computer books
database means it should have only those books, it should not contain a single record of Civil
books. Means logically it is not same)
3. A database is designed, built, and populated with data for a specific purpose. It has an
intended group of users and some predefined applications in which these users are interested.In
short, a database has some source from which data is derived, some degreeof interaction with
events in the real world, and an audience that is actively interested in its contents. The end users
of a database may perform business transactions (eg, a customer buys a camera) or events may
happen (eg, student’s achievement - winning a tournament / India wining world cup) that cause
the information in the database to change.
4. Database must be accurate and reliable at all times, means changes must be reflected in the
database as soon as possible.
- the computerized catalog of a large library may contain half a million entries organized
under different categories—by primary author’s last name, by subject, by book title—
with each category organized alphabetically.
- the list of student / employee names and addresses referred to a college or a big company
like IBM / TCS where many branches in many countries available, will have a complex
structure.
- Still more complex means database of Department of Income tax which has to maintain
past few years returns of each taxpayer and also current return of every citizen who
is/was filing the form. So huge amount of information must be organized and managed
so that users can search for, retrieve, and update the data as needed.
DBMS : A database management system (DBMS) is a collection of programs that enables users
to create and maintain a database.
- The database definition or descriptive information is also stored by the DBMS in the
form of a database catalog or dictionary; it is called meta-data.
Sharing a database allows multiple users and programs to access the database simultaneously.
Protection includes
- System protection: Preventing database from being corrupted when hardware or
software failures occur
- security protection: Preventing unauthorized or malicious access to database.
Maintaining A typical large database may have a life cycle of many years, so the DBMS must be
able to maintain the database system by allowing the system to evolve as requirements change
over time.
QUERY
An application program accesses the database by sending queries or requests for data to
the DBMS. A query typically causes some data to be retrieved; a transaction may cause some
data to be read and some data to be written into the database.
[It is not absolutely necessary to use general-purpose DBMS software to implement a
computerized database. We could write our own set of programs to create and maintain the
database, in effect creating our own special-purpose DBMS software. In either case—whether
we use a general-purpose DBMS or not—we usually have to deploy a considerable amount of
complex software. In fact, most DBMSs are very complex software systems. ]
An Example
A UNIVERSITY database for maintaining information concerning students, courses, and grades in
a university environment.
The database is organized as five files / relation / table has a set of named fields /
attributes / columns, each of which is specified of the same data type. (In addition to a datatype,
we might put further restrictions upon a field, eg., GRADE_REPORT must have a value from the
set {‘A’,’B’…’F’} )
Each table will be populated with data in the form of records / tuples/ rows, each of which
represents some entity (in the miniworld) or some relationship between entities.
Defining the database, we must specify the structure of the records of each file byspecifying the
different types of data elements to be stored in each record.
Constructing the database, the records in the various files may be related.
[Defining the database Each STUDENT record includes data to represent the student’s Name,
Student_number, Class (such as freshman or ‘1’, sophomore or ‘2’, and so forth), and Major (such
as mathematics or ‘MATH’ and computer science or ‘CS’). A data type for each data element
within a record should be specified. For example, we can specify that Name of STUDENT is a string
of alphabetic characters, Student_number of STUDENT is an integer, and Grade of
GRADE_REPORT is a single character from the set {‘A’, ‘B’, ‘C’, ‘D’, ‘F’, ‘I’}. Coding scheme can also
be used to represent the values of a data item. For example, we represent the Class of a STUDENT
as 1 for freshman, 2 for sophomore, 3 for junior, 4 for senior, and 5 for graduate student.
Constructing the database For example, the record for Smith in the STUDENT file is related to
two records in the GRADE_REPORT file that specify Smith’s grades in two sections. Similarly, each
record in the PREREQUISITE file relates two course records: one representing the course and the
other representing the prerequisite.
Most medium-size and large databases include many types of records and have many
relationships among the records.
Manipulation of database
Examples of queries are as follows:
■Retrieve the transcript(s) of student named ‘Smith’
■List the names of students who took the section of the ‘Database’ course offered in fall 2008
and their grades in that section
■List the prerequisites of the ‘Database’ course
Conceptual design that can be represented and manipulated using some computerizedtools so
that it can be easily maintained, modified, and transformed into a databaseimplementation.
Logical design that can be expressed in a data model implemented in a commercial DBMS.
Physical design, last level, during which further specifications are provided for storing
andaccessing the database. The database design is implemented, populated with actual data,
and continuously maintained to reflect the state of the mini-world.
In traditional file processing, each user defines and implements the files needed for a
specific software application as part of programming the application.
For example, one user, the grade reporting office, may keep a file on students and their
grades. Programs to print a student's transcript and to enter new grades into the file are
implemented as part of the application.
A second user, the accounting office, may keep track of students' fees and their payments.
Although both users are interested in data about students, each user maintains separate files-
and programs to manipulate these files-because each requires some data not available from the
other user's files. This redundancy in defining and storing data results in wasted storage space
and in redundant efforts to maintain common data up to date.
File processing approach: Data redundancy and inconsistency are the drawbacks
Database approach: A single repository of data is maintained that is defined once and then is
accessed by various users.
The main characteristics of the database approach versus the file-processing approach
are the following:
The database contains a complete definition or description of the database structure and
constraints. (This is the fundamental characteristic of the database approach)
This definition is stored in the DBMS systemcatalog, which contains information such as
the structure of each file, the type and storage format of each data item, and various constraints
on the data.
The information stored in the catalog is called meta-data, and it describes the structure
of the primary database.
A DBMS catalog stores the description of the database. The description is called meta-data .
This allows the DBMS software to work with different databases.
Catalog: structure of each file, type & storage format of each data item, constraints on data
[ Users - Who need to know the names of tables and attribures, and sometimes data type
information and other things
DBMS software- which certainly needs to “know” how the data is structured / organized
in order to interpret it in a manner consistent with that structure.
In traditional file processing, data definition is typically part of the application programs
themselves. Hence, these programs are constrained to work with only onespecific database,
whose structure is declared in the application programs. For example, an application program
written in c++ may have struct or class declarations, and a COBOL program has Data Division
statements to define its files. Whereas file-processing software can access only specific
databases, DBMS software can access diverse databases by extracting the database definitions
from the catalog and then using these definitions. ]
In traditional file processing, the structure of data files is embedded in the application
programs, so any changes to the structure of a file may require changing all programsthat access
this file. [If we decide to change the structure of the data (eg., by adding the first two digits to
the YEAR field, in order to make the program Y2K complaint), every application in which a
description of that file’s structure is hard-coded must be changed. ]
In contrast, DBMS access programs do not require such changes in most cases, because
the structure of data files is stored in the DBMS catalog separately from the access programs.
This property is called as program-data independence.
For example, a file access program may be written in such a way that it can access only
STUDENT records of the structure shown in Fig 1.2. If we want to add another piece of data to
each STUDENT record, say the BirthDate, such a program will no longer work and must be
changed. This is possible because the user can define operations on data as part of the database
definitions.
[By contrast, in a DBMS environment, it is just need to change the description of STUDENT
records in the catalog to reflect the inclusion of the new data item BirthDate; no programs are
changed. The next time a DBMS program refers to the catalog, the new structure of STUDENT
records will be accessed and used.
In other words, the DBMS provides a conceptual or logical view of the data to application
programs, so that the underlying implementation may be changed without the programs being
modified(This is referred to as program-data independence)
Also, which access paths (eg., indexes) exist are listed in the catalog, helping the DBMS to
determine the most efficient way to search for items in response to a query.
Informally, a data model is a type of data abstraction that is used to provide this
conceptual representation. The data model uses logical concepts, such as objects, their
properties, and their interrelationships, that may be easier for most users to understand than
computer storage concepts. Hence, the data model hides storage and implementation details
that are not of interest to most database users. ]
A multiuser DBMS whose users have a variety of distinct applications must provide
facilities for defining multiple views.
For example, one user of the database of Fig 1.2 may be interested only in accessing and
printing the transcript of each student; the view for this user is shown in Figure 1.3a.
A second user, who is interested only in checking that students have taken all the
prerequisites of each course for which they register, may require the view shown in Figure l.4b.
• Each user may see a different view of the database, which describes only the data of
interest to that user.
• A good DBMS has facilities for defining multiple views. This is not only convenient for
users, but also addresses security issues of data access.(eg., The Registrar’s office view
should not provide any means to access financial data)
Fig: 1.3 Two views derived from the database in Figure 1.2 (a) The STUDENT TRANSCRIPT View (b) The
COURSE PREREQUISTES View
Eg: Airline flight reservation such applications are called as online transaction processing
[OLTP] applications, when several reservation clerks try to assign a seat on an airline flight, the
DBMS should ensure that each seat can be accessed by only one clerk at a time for assignment
to a passenger. A fundamental role of multiuser DBMS software is to ensure that concurrent
transactions operate correctly.
transactions may be executing concurrently. The atomicity property ensures that either all the
database operations in a transaction are execute
This given rise to the concept o a transaction, which is a process that makes one or more
accessed to a database and which must have the appearance of executing in isolation form all
other transactions (even ones that access the same data at the same time) and of being atomic
(in the sense that, if the system crashes in the middle of its execution, the database contents
must be as though it did not execute at all). Application such as airline reservation systems are
known as online transaction processing applications.
Database System Concepts and Architecture: In basic client/server DBMS architecture, the
system functionality is distributed between two types of modules.
A client module,typically designed so that it will run on a user workstation or personal computer.
Typically, application programs and user interfaces that access the database run in the client
module. Hence, the client module handles user interaction and provides the user-friendly
interfaces such as forms- or menu-based GUIs (graphical user interfaces).
A server module, typically handles data storage, access, search, and other functions . A
characteristic of the database approach is that it provides a level of data abstraction, by
hiding details of data storage that are not needed by most users.
A data model - is a collection of concepts that can be used to describe the conceptual / logical
structure of a database. The model provides the necessary means to achieve the abstraction.
Data models are changing to include concepts to specify the behaviour of the database
application. This allows designers to specify a set of user defined operations that are allowed.
➢ High level / conceptual data models – provides a view close to the way users would perceive
the data; uses concepts such as
• Entity – represents a real world object or concept (eg., student, employee, course,
department, event)
• Attribute - represents property of interest that describes an entity, such as name,
salary, height, age, colour.
• Relationship – among two or more entities, represents an association among two
or more entities. ( works-on relationship between an employee and a project)
➢ Low-level / Physical data models – provide concepts that describe the details of how data
is stored in the computer system, such as record formats, record orderings and access
paths(indexes). These concepts are generally meant for the specialist, and not the end user.
An access path is a structure that makes the search for particular database data records
efficient.
An index is an example of an access path that allows direct access to data using an index term
or a keyword.
➢ Object data models group (ODMG) – a group of higher level implementation data models
closer to conceptual data models.
The description of a database is called the database schema. The schema is specified
during database design, and is not expected to change frequently.
Data models have conventions for displaying schemas as diagrams. A displayed schema
is called a schema diagram. Each object in the schema is called a schema construct. Schema
diagrams display only some aspects of a schema, such as names and some constraints.
The actual data stored in the database may change frequently, every time records are
added or updated. The data in the database at a particular time is called the database state or
snapshot.
When a database is defined, the schema is specified to the DBMS. The database state at
this point is the empty state with no data. The initial state of the database is when the database
is first populated or loaded with the initial data. Every time data is added/removed/updated,
there is a new database state. The DBMS is responsible for ensuring every state is a valid state, a
state that satisfies the structure and constraints specified in the schema.
The DBMS stores the descriptions of the schema constructs and constraints, called the
meta data, in the DBMS catalogue.
The schema is called the intension, and the database state is called an extension of the schema.
Application requirements change occasionaly, which is one of the reasons why software
maintenance is important. On such occasions, a change to a database's schema may be called
for. An example would be to add a Date_of_Birth field/ attribute to the STUDENT table. Making
changes to a database schema is known as schema evolution. Most modern DBMS's support
schema evolution operations that can be applied while a database is operational.
▪ In databases where there is a separation between the conceptual and internal schemas
DDL - is used to specify the conceptual schema, and SDL, storage definition language
- is used to specify the internal schema.
▪ For true three-schema architecture, VDL, view definition language, is used to specify the
user views and their mappings to the conceptual schema.
But in most DBMSs, the DDL is used to specify both the conceptual schema and the
external schemas.
[Once the schemas are compiled, and the database is populated with data, users need to
manipulate the database. Manipulations include retrieval, insertion, deletion and
modification. ]
▪ The DBMS provides operations using the DML, data manipulation language, used for
performing operations such as retrieval and update upon the populated database.
▪ In most DBMSs, the VDL, DML and the DML are not considered as separate languages, but
a comprehensive integrated language for conceptual schema definition, view definition
and data manipulation. Storage definition is kept separate to fine-tune the performance,
usually done by the DBA staff.
▪ An example of a comprehensive language: SQL, which represents a VDL, DDL, DML as well
as statements for constraint specification, etc.
Low Level/Procedural
▪ Must be embedded in a general purpose programming language.
▪ Typically retrieves individual records or objects from the database and processes each
separately.
▪ Therefore it needs to use programming language constructs such as loops.
▪ Low-level DMLs are also called record at a time DMLS because of this.
▪ High-level DMLs, such as SQL can specify and retrieve many records in a single DML
statement, and are called set at a time or set oriented DMLs.
▪ High-level languages are often called declarative, because the DML often specifies what
to retrieve, rather than how to retrieve it.
DML Commands
▪ When DML commands are embedded in a general purpose programming language, the
programming language is called the host language and the DML is called the data sub-
language.
▪ High-level languages used in a standalone, interactive manner is called a query language.
▪ Casual end users use high-level query language to specify requests, where programmers
usually use embedded DML.
▪ Parametric end users usually interact with user-friendly interfaces, which can also be used
by casual users who don’t want to learn the high-level languages.
1.4.2DBMS Interfaces
Forms-Based Interfaces
▪ Displays a form to each user.
▪ User can fill out form to insert new data or fill out only certain entries.
▪ Designed and programmed for naïve users as interfaces to canned transactions.
Figure 1.5 shows a simplified overview of the database design process. The first step shown
isrequirements collection and analysis. During this step, the database designers interview
prospective database users to understand and document their data requirements. The result of
this step is a concisely written set of users’ requirements. These requirements should be specified
in as detailed and complete a form as possible.
In parallel with specifying the data requirements, it is useful to specify the known functional
requirements of the application. These consist of the user-definedoperations (or transactions)
that will be applied to the database, includingboth retrievals and updates.
Once the requirements have been collected and analyzed, the next step is to create
aconceptual schema for the database, using a high-level conceptual data model. Thisstep is
called conceptual design. The conceptual schema is a concise description ofthe data
requirements of the users and includes detailed descriptions of the entitytypes, relationships,
and constraints; these are expressed using the concepts providedby the high-level data model.
Because these concepts do not include implementationdetails, they are usually easier to
understand and can be used tocommunicate with nontechnical users. The high-level conceptual
schema can alsobe used as a reference to ensure that all users’ data requirements are met and
that therequirements do not conflict. This approach enables database designers to
concentrateon specifying the properties of the data, without being concerned with storageand
implementation details. This makes it is easier to create a good conceptual databasedesign.
During or after the conceptual schema design, the basic data model operations canbe used
to specify the high-level user queries and operations identified during functionalanalysis. This
also serves to confirm that the conceptual schema meets all theidentified functional
requirements. Modifications to the conceptual schema can beintroduced if some functional
requirements cannot be specified using the initialschema.
The next step in database design is the actual implementation of the database, usinga
commercial DBMS. Most current commercial DBMSs use an implementationdata model—such
REVA University Page 17
UNIT – I Database Management Systems
The last step is the physical design phase, during which the internal storage structures,file
organizations, indexes, access paths, and physical design parameters forthe database files are
specified. In parallel with these activities, application programsare designed and implemented as
database transactions corresponding to the high-leveltransaction specifications.
The company is organized into departments. Each department has a uniquename, a unique
number, and a particular employee who manages thedepartment.We keep track of the start date
when that employee began managingthe department. A department may have several locations.
Entity
▪ The basic object of the ER model is an entity
▪ An entity represents a 'thing' of interest to us ( in the real world) about which we want to
maintain some data ( for the representation in a database.)
▪ An entity may be object with a physical existence eg., person, car, house, employee,
student
▪ An entity may be object with conceptual existence eg., a company, a job, a course
Attributes
▪ An entity is represented by as set of properties/ characteristics called attributes.
▪ The attributes are useful in describing the properties of each entity in the entity set.
▪ Theseproperties reflects the sort of information which is stored in the database.
[ Every entity will have some set of properties. These properties are used to distinguish
one entity from another entity. These properties termed as attributes. ]
▪ eg the attributes of the entity of
a student - Reg. No., Name, Course
[Composite attributes can be used if the attribute is referred to as the whole, and the atomic
attributes are not referred to. For example, if you wish to store the Company Location, unless
you will use the atomic information such as Postal Code, or City separately from the other
Location information (Street Address etc) then there is no need to subdivide it into its component
attributes, and the whole Location can be designated as a simple attribute. ]
5. Complex Attributes
▪ Complex attributes are attributes that are nested in an arbitrary way.
▪ For example a person can have more than one residence, and each residence can have more
than one phone, therefore it is a complex attribute that can be represented as:
▪ Multi-valued attributes are displayed between braces { }
▪ Complex Attributes are represented using parentheses ( )
E.g. {AddressPhone({Phone(AreaCode, PhoneNumber)}, Address(StreetAddress(Number,
Street, ApartmentNumber), City, State, Zip))}
The entity type describes the intension, or schema for a set of entities that share the same
structure. The collection of entities of a particular entity type is grouped into the entity set, called
the extension.
Entities with the same basic attributes are grouped or typed into an entity type.
For example, the entity type EMPLOYEE and PROJECT.
An attribute of an entity type for which each entity must have a unique value is calleda key
attribute of the entity type. For example, SSN of EMPLOYEE.
This example shows three CAR entity instances in the entity set for CAR
Same name (CAR) used to refer to both the entity type and the entity set.
We can now define the entity types for the COMPANY database, based on
therequirements described in Section 1.5. After defining several entity types and theirattributes
here, we refine our design in next section, after we introduce the concept ofa relationship.
According to the requirements listed in Section 1.5, we can identifyfour entity types—one
corresponding to each of the four items in the specification (see Figure 1.6):
1. An entity type DEPARTMENT with attributes Name, Number, Locations,Manager, and
Manager_start_date. Locations is the only multivalued attribute.We can specify that both Name
and Number are (separate) key attributesbecause each was specified to be unique.
2. An entity type PROJECT with attributes Name, Number, Location, andControlling_department.
Both Name and Number are (separate) key attributes.
3. An entity type EMPLOYEE with attributes Name, Ssn, Sex, Address, Salary,Birth_date,
Department, and Supervisor. Both Name and Address may be compositeattributes; however, this
was not specified in the requirements. Wemust go back to the users to see if any of them will
refer to the individualcomponents of Name—First_name, Middle_initial, Last_name—or of
Address.
4. An entity type DEPENDENT with attributes Employee, Dependent_name, Sex,Birth_date, and
Relationship (to the employee).
Fig 1.6: Preliminary design of entity types for the COMPANY database.
1.7 Relationship
eg., We can define a relationship which associates the CUSTOMER with an item Color TV
Note: Whenever an attribute of one entity type refers to an entity(of the same type or
different type),we say that a relationship exists between the two entities.
Note: In ER diagram, relationship type are displayed as DIAMOND shape boxes, which
are connected by straight line to the rectangular box representing participating entity types
relationship name is displayed in the diamond shaped box.
Relationship Types
Relationships of the same type are grouped or typed into a relationship type.
As for the entity types and entity sets, a relationship type and its corresponding
relationship set are customarily referred to by the same name, R.
Hence, a relationship set is a mathematical relation on E1, E 2, ..., En. Each of the entity
types E1, E 2, ..., En is said to be participate in the relationship type R. Similarly each of the
individual entities e1, e 2, ..., en is said to be participate in the relationship instance r i = ( e1,
e 2, ..., en ).
For example, consider a relationship type WORKS_FOR between the two entity type
EMPLOYEEs and DEPARTMENT, which associates each employee with the department the
employee works for
In the original Chen notation, the relationship is placed inside a diamond, Connected to the
participating entity types via straight lines. As always, there are many notations in use today...
e.g.managers manage employees
Relationship Degree
Supplier S
Part P
Project J
Each entity type that participates in a relationship type plays a particular role in the
relationship. The role name signifies the role that a participating entity from the entity type plays
in each relationship instance, and helps to explain what the relationship means.
For example, in the WORKS_FOR relationship type, EMPLOYEE plays the role of employee
or worker and DEPARTMENT plays the role of department or employer. Role names are not
technically necessary in relationship types where all the participating entity types are distinct,
since each participating entity type name can be used as the role name.
However, in some cases the same entity type participates more than once in a relationship type
in different roles. In such cases the role name becomes essential for distinguishing the meaning
of the role that each participating entity plays. Such relationship types are called recursive
relationships.
The relationship
of SUPERVISION
between SUPERVISION
and EMPLOYEE
where the
employee entity
type plays two
roles
1 SUPERVISION
(BOSS)
2SUPERVISE
(Subordinates)
Cardinality Ratios for Binary Relationships: Thecardinality ratio for a binary relationship
specifies the maximum number of relationship instances that an entity can participate in.
The possible cardinality ratios for binary relationship types are 1:1, 1: N, N: 1, M: N
Eg, in the WORKS_FOR binary relationship type, DEPARTMENT: EMPLOYEE is of cardinality ratio
1: N, [meaning that each department can be related to any number of employees, but an
employee can be related to (work for) only one department. This means that for this particular
relationship WORKS_FOR, a particular department entity can be related to any number of
employees (N indicates there is no maximum number). On the other hand, an employee can be
related to a maximum of one department. ]
cardinality constraint.
There are two types of participation constraints—total and partial
In ER diagrams,
- total participation (or existence dependency) is displayed as a double line connecting the
participating entity type to the relationship,
- partial participation is represented by a single line
A weak entity does not have a distinguishing attribute of its own and mostly are dependent
entities, which are part of some another entity.
A weak entity type always has a total participation constraint (existence dependency)
with respect to its identifying relationship because a weak entity cannot be identified without an
owner entity. However, not every existence dependency results in a weak entity type. For
example, a DRIVER_LICENSE entity cannot exist unless it is related to a PERSON entity, even
though it has its own key (License_number) and hence is not a weak entity.
Consider the entity type DEPENDENT, related to EMPLOYEE, which is used to keep track
of the dependents of each employee via a 1:N relationship . In our example, the attributes of
DEPENDENT are Name (the first name of the dependent), Birth_date, Sex, and Relationship (to
the employee). Two dependents of two distinct employees may, by chance, have the same values
for Name, Birth_date, Sex, and Relationship, but they are still distinct entities. They are identified
as distinct entities only after determining the particular employee entity to which each
dependent is related. Each employee entity is said to own the dependent entities that are related
to it.
A weak entity type normally has a partial key, which is the attribute that can uniquely
identify weak entities that are related to the same owner entity. In our example, if we assume
that no two dependents of the same employee ever have the same first name, the attribute
Name of DEPENDENT is the partial key. In the worst case, a composite attribute of all the weak
entity’s attributes will be the partial key.
In ER diagrams, both a weak entity type and its identifying relationship are distinguished
by surrounding their boxes and diamonds with double lines. The partial key attribute is
underlined with a dashed or dotted line.
Multivalued attributes are shown in double ovals, as illustratedby the Locations attribute
of DEPARTMENT. Key attributes have their namesunderlined. Derived attributes are shown in
dotted ovals, as illustrated by theNumber_of_employees attribute of DEPARTMENT.Weak entity
types are distinguished by being placed in double rectangles and byhaving their identifying
relationship placed in double diamonds, as illustrated bythe DEPENDENT entity type and the
DEPENDENTS_OF identifying relationshiptype. The partial key of the weak entity type is
underlined with a dotted line.
In Figure 1.7 the cardinality ratio of each binary relationship type is specified byattaching
a 1, M, or N on each participating edge. The cardinality ratio ofDEPARTMENT:EMPLOYEE in
MANAGES is 1:1, whereas it is 1:N for DEPARTMENT:EMPLOYEE in WORKS_FOR, and M:N for
WORKS_ON. The participationconstraint is specified by a single line for partial participation and
by double linesfor total participation (existence dependency).
In Figure 1.7 we show the role names for the SUPERVISION relationship typebecause the
same EMPLOYEE entity type plays two distinct roles in that relationship.Notice that the
cardinality ratio is 1:N from supervisor to supervisee because eachemployee in the role of
supervisee has at most one direct supervisor, whereas anemployee in the role of supervisor can
supervise zero or more employees.Figure 1.8 summarizes the conventions for ER diagrams.
Another naming consideration involves choosing binary relationship names tomake the
ER diagram of the schema readable from left to right and from top to bottom.We have generally
followed this guideline in Figure 1.7. To explain this namingconvention further, we have one
exception to the convention in Figure 1.7—theDEPENDENTS_OF relationship type, which reads
from bottom to top. When wedescribe this relationship, we can say that the DEPENDENT entities
(bottom entitytype) are DEPENDENTS_OF (relationship name) an EMPLOYEE (top entity type).To
change this to read from top to bottom, we could rename the relationship type
toHAS_DEPENDENTS, which would then read as follows: An EMPLOYEE entity (topentity type)
HAS_DEPENDENTS (relationship name) of type DEPENDENT (bottomentity type).