DBMS Question Bank

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Database Management System Notes

MCQ QUESTIONS

1. Which type of data can be stored in the database?


a) Image oriented data
b) Text, files containing data
c) Data in the form of audio or video
d) All of the above

Answer: d

2. In which of the following formats data is stored in the database management


system?
a) Image
b) Text
c) Table
d) Graph

Answer: c

3. Which of the following is not a type of database?


a) Hierarchical
b) Network
c) Distributed
d) Decentralized

Answer: d

4. Which of the following is not an example of DBMS?


a) MySQL
b) Microsoft Acess
c) IBM DB2
d) Google

Answer: d

5. Which of the following is not a feature of DBMS?


a) Minimum Duplication and Redundancy of Data
b) High Level of Security
c) Single-user Access only
d) Support ACID Property

Answer: c

6. Which of the following is a feature of the database?


a) No-backup for the data stored
b) User interface provided
c) Lack of Authentication
d) Store data in multiple locations

Answer: b

7. Which of the following is not a function of the database?


a) Managing stored data
b) Manipulating data
c) Security for stored data
d) Analysing code

Answer: d

8. Which of the following is a function of the DBMS?


a) Storing data
b) Providing multi-users access control
c) Data Integrity
d) All of the above

Answer: d

9. Which of the following is a component of the DBMS?


a) Data
b) Data Languages
c) Data Manager
d) All of the above

Answer: d

10. Which of the following is known as a set of entities of the same type that share
same properties, or attributes?
a) Relation set
b) Tuples
c) Entity set
d) Entity Relation model

Answer: c

11. What is information about data called?


a) Hyper data
b) Tera data
c) Meta data
d) Relations

Answer: c

12. Which of the following is a set of one or more attributes taken collectively to
uniquely identify a record?
a) Primary Key
b) Foreign key
c) Super key
d) Candidate key

Answer: c

13. The ability to query data, as well as insert, delete, and alter tuples, is offered by
____________
a) TCL (Transaction Control Language)
b) DCL (Data Control Language)
c) DDL (Data Definition Langauge)
d) DML (Data Manipulation Langauge)

Answer: d

14. Which command is used to remove a relation from an SQL?


a) Drop table
b) Delete
c) Purge
d) Remove

Answer: a

15. The given Query can also be replaced with

SELECT name, course_id

FROM instructor, teaches

WHERE instructor_ID= teaches_ID;

a) Select name,course_id from teaches,instructor where instructor_id=course_id;

b) Select name, course_id from instructor natural join teaches;

c) Select name, course_id from instructor;

d) Select course_id from instructor join teaches;

Answer: b

16. Which one of the following given statements possibly contains the error?

a) select * from emp where empid = 10003;

b) select empid from emp where empid = 10006;

c) select empid from emp;

d) select empid where empid = 1009 and Lastname = 'GELLER';

Answer: d
17. What do you mean by one to many relationships?

a) One class may have many teachers

b) One teacher can have many classes

c) Many classes may have many teachers

d) Many teachers may have many classes

Answer: b

18. Which of the following refers to the level of data abstraction that describes exactly
how the data actually stored?

a) Conceptual Level

b) Physical Level

c) File Level

d) Logical Level

Answer: b

19. To which of the following the term "DBA" referred?

a) Data Bank Administrator

b) Database Administrator

c) Data Administrator

d) None of the above

Answer: b

20. In general, a file is basically a collection of all related

a) Rows & Columns

b) Fields

c) Database

d) Records

Answer: d
Descriptive Questions

1. What you means by DBMS?


A database is a collection of related data. By data, we mean known facts that can be
recorded and that have implicit meaning. For example, consider the names, telephone
numbers, and addresses of the people you know. You may have recorded this data in
an indexed address book or you may have stored it on a hard drive, using a personal
computer and software such as Microsoft Access or Excel. This collection of related
data with an implicit meaning is a database.
2. Describe Data base management system (DBMS).
A database management system (DBMS) is a collection of programs that enables
users to create and maintain a database. The DBMS is a general-purpose software
system that facilitates the processes of defining, constructing, manipulating, and
sharing databases among various users and applications. Defining a database involves
specifying the data types, structures, and constraints of the data to be stored in the
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.
Constructing the database is the process of storing the data on some storage medium
that is controlled by the DBMS.

3. Explain the Advantages of Database Management System (DBMS)

1. Improved data sharing


An advantage of the database management approach is, the DBMS helps to create an
environment in which end users have better access to more and better-managed data.
Such access makes it possible for end users to respond quickly to changes in their
environment.
2. Improved data security
The more users access the data, the greater the risks of data security breaches.
Corporations invest considerable amounts of time, effort, and money to ensure that
corporate data are used properly. A DBMS provides a framework for better
enforcement of data privacy and security policies.

3. Better data integration


Wider access to well-managed data promotes an integrated view of the organization’s
operations and a clearer view of the big picture. It becomes much easier to see how
actions in one segment of the company affect other segments.

4. Minimized data inconsistency


Data inconsistency exists when different versions of the same data appear in different
places. For example, data inconsistency exists when a company’s sales department
stores a sales representative’s name as “Bill Brown” and the company’s personnel
department stores that same person’s name as “William G. Brown,” or when the
company’s regional sales office shows the price of a product as $45.95 and its
national sales office shows the same product’s price as $43.95. The probability of data
inconsistency is greatly reduced in a properly designed database.

5. Improved data access


The DBMS makes it possible to produce quick answers to ad hoc queries. From a
database perspective, a query is a specific request issued to the DBMS for data
manipulation—for example, to read or update the data. Simply put, a query is a
question, and an ad hoc query is a spur-of-the-moment question. The DBMS sends
back an answer (called the query result set) to the application. For example, end users,
when dealing with large amounts of sales data, might want quick answers to questions
(ad hoc queries) such as:
- What was the dollar volume of sales by product during the past six months?
- What is the sales bonus figure for each of our salespeople during the past three
months?
- How many of our customers have credit balances of 3,000 or more?

6. Improved decision making


Better-managed data and improved data access make it possible to generate better-
quality information, on which better decisions are based. The quality of the
information generated depends on the quality of the underlying data. Data quality is a
comprehensive approach to promoting the accuracy, validity, and timeliness of the
data. While the DBMS does not guarantee data quality, it provides a framework to
facilitate data quality initiatives.

7. Increased end-user productivity


The availability of data, combined with the tools that transform data into usable
information, empowers end users to make quick, informed decisions that can make
the difference between success and failure in the global economy.
4. Explain Disadvantages of Database Management System (DBMS)
Although the database system yields considerable advantages over previous data
management approaches, database systems do carry significant disadvantages.
For example:
1. Increased costs
one of the disadvantages of dbms is Database systems require sophisticated hardware
and software and highly skilled personnel. The cost of maintaining the hardware,
software, and personnel required to operate and manage a database system can be
substantial. Training, licensing, and regulation compliance costs are often overlooked
when database systems are implemented.

2. Management complexity
Database systems interface with many different technologies and have a significant
impact on a company’s resources and culture. The changes introduced by the adoption
of a database system must be properly managed to ensure that they help advance the
company’s objectives. Given the fact that database systems hold crucial company data
that are accessed from multiple sources, security issues must be assessed constantly.

3. Maintaining currency
To maximize the efficiency of the database system, you must keep your system
current. Therefore, you must perform frequent updates and apply the latest patches
and security measures to all components.
Because database technology advances rapidly, personnel training costs tend to be
significant. Vendor dependence. Given the heavy investment in technology and
personnel training, companies might be reluctant to change database vendors.
As a consequence, vendors are less likely to offer pricing point advantages to existing
customers, and those customers might be limited in their choice of database system
components.

4. Frequent upgrade/replacement cycles


DBMS vendors frequently upgrade their products by adding new functionality. Such
new features often come bundled in new upgrade versions of the software. Some of
these versions require hardware upgrades. Not only do the upgrades themselves cost
money, but it also costs money to train database users and administrators to properly
use and manage the new features.

5. What are the Database Management Components?


6. A Database Management System (DBMS) is software that enables users to interact
with a database efficiently and securely. It serves as an intermediary between the end-
users and the database, handling various tasks related to data storage, retrieval,
modification, and administration. The main components of a typical DBMS include:
1. Database: The database is a collection of organized and structured data, usually
stored in electronic format, managed by the DBMS. It can include tables, views,
indexes, and other database objects that hold data and relationships.
2. Data Definition Language (DDL): DDL is a subset of SQL (Structured Query
Language) used to define and manage the database structure. It includes
commands for creating, altering, and dropping database objects like tables,
indexes, views, and schemas.
3. Data Manipulation Language (DML): DML is another subset of SQL used to
interact with the data within the database. It includes commands like SELECT,
INSERT, UPDATE, and DELETE, allowing users to retrieve, modify, and
remove data from the database.
4. Data Query Language (DQL): DQL is a subset of SQL specifically used for
querying data from the database. It primarily consists of SELECT statements to
retrieve specific data based on specified conditions.

5. Data Administration: The DBMS provides tools for managing the database,
including tasks like backup and recovery, security management, user access
control, and performance optimization.
6. Database Schema: The database schema defines the structure of the database,
including tables, their columns, data types, relationships, and constraints. It acts as
a blueprint for the organization of data within the database.
7. Data Integrity: DBMS ensures data integrity by enforcing constraints and rules
on the data to maintain its accuracy and consistency. Common integrity
constraints include primary keys, foreign keys, unique constraints, and check
constraints.
8. Query Optimizer: The query optimizer is a crucial component responsible for
analyzing SQL queries and determining the most efficient execution plan. It aims
to minimize query execution time by choosing the optimal approach for accessing
data.
9. Transaction Management: DBMS supports transactions, which are sequences of
database operations that are executed as a single unit. Transactions ensure data
consistency and integrity, allowing for a rollback in case of failures or errors.
10. Concurrency Control: Concurrency control is responsible for managing multiple
user requests to access and modify data simultaneously. It prevents conflicts and
ensures that the data remains consistent even in multi-user environments.
11. Indexing: Indexes are data structures that enhance the speed of data retrieval
operations by providing quick access paths to specific data based on certain
columns. They optimize the performance of queries that involve search
conditions.

7. Draw the simplified database system environment.


Fig: simplified database system environment
8. Explain different types of databases.
Databases can be classified into various types based on their data models, storage
methods, and intended use cases. Here are some of the different types of databases:

Relational Databases:
Relational databases are the most common type of databases used in various
applications. They use a tabular structure to store data, where data is organized into
rows and columns. Each table represents an entity, and the relationships between
entities are established using primary keys and foreign keys. Examples of relational
databases include MySQL, PostgreSQL, Oracle, and Microsoft SQL Server.

NoSQL Databases:
NoSQL (Not Only SQL) databases are designed to handle large-scale, unstructured,
or semi-structured data. They provide flexible schemas, allowing data to be stored in
various formats like key-value pairs, document-oriented, column-family, or graph-
based. NoSQL databases are well-suited for handling big data and real-time
applications. Popular NoSQL databases include MongoDB, Cassandra, Couchbase,
and Redis.

Object-Oriented Databases:
Object-oriented databases (OODBs) are designed to store and manage object-oriented
data models directly. They bridge the gap between programming languages and
databases, enabling objects to be stored, retrieved, and manipulated as they are,
without the need for mapping to a relational structure. OODBs are useful for object-
oriented applications where the data model aligns closely with the programming
model.

Graph Databases:
Graph databases are specialized databases that store and manage data in the form of
nodes, edges, and properties. They are used for handling highly interconnected data
and are especially effective for applications involving social networks,
recommendation systems, and knowledge graphs. Graph databases offer powerful
querying capabilities for traversing relationships between nodes. Examples include
Neo4j and Amazon Neptune.

Time-Series Databases:
Time-series databases are optimized for handling time-stamped data, such as IoT
sensor data, financial data, and monitoring data. They efficiently store and retrieve
data based on timestamps, allowing for fast and flexible time-based queries. Popular
time-series databases include InfluxDB, Prometheus, and OpenTSDB.

Spatial Databases:
Spatial databases are designed to store and manage spatial data, such as geographic
information system (GIS) data, maps, and location-based data. They support spatial
indexing and offer specialized spatial query functions to efficiently handle spatial
data. Examples include PostGIS (an extension for PostgreSQL) and Oracle Spatial.

XML Databases:
XML databases are specialized databases that store and manage XML (eXtensible
Markup Language) data. They are suitable for applications that handle XML-based
documents and need to query and manipulate XML data efficiently. Examples include
BaseX and eXist-db.

Columnar Databases:
Columnar databases store data in columns rather than rows, making them highly
efficient for analytical queries and data warehousing. They are optimized for handling
large volumes of data and aggregations. Examples include Google Bigtable and
Apache HBase.

9. Explain the Characteristics of the Database Approach.


The database approach is a method of managing and organizing data using a Database
Management System (DBMS). It offers several characteristics that differentiate it
from traditional file-based approaches. The key characteristics of the database
approach are as follows:
Data Independence: In the database approach, data is separated from the applications
that use it. This means that the structure and storage of data are independent of the
programs accessing it. It provides both logical data independence (ability to modify
the database schema without affecting the applications) and physical data
independence (ability to change the physical storage of data without impacting
applications).

Data Integration: The database approach promotes data integration by allowing data
from different sources and applications to be stored in a centralized database. This
enables efficient data sharing and eliminates data redundancy, leading to a single,
consistent view of the data across the organization.

Data Abstraction: The database approach employs data abstraction, which means
that users interact with the database using high-level, simplified views of the data.
This abstraction hides the complexities of data storage and retrieval, making it easier
for users to work with the data.

Data Integrity and Security: A robust DBMS enforces data integrity constraints,
ensuring that data remains accurate and consistent. It also provides mechanisms for
access control and user authentication, safeguarding the data from unauthorized
access and maintaining data security.

Concurrent Access and Transaction Management: The database approach supports


concurrent access to the data by multiple users or applications. It incorporates
transaction management to ensure that groups of related database operations are
treated as a single unit, maintaining data consistency even in multi-user environments.

Backup and Recovery: DBMS provides mechanisms for data backup and recovery,
allowing organizations to create copies of the database at different points in time and
restore it to a previous state in case of data loss or system failure.

Data Independence: In the database approach, data is separated from the applications
that use it. This means that the structure and storage of data are independent of the
programs accessing it. It provides both logical data independence (ability to modify
the database schema without affecting the applications) and physical data
independence (ability to change the physical storage of data without impacting
applications).

Data Security: A database approach allows for centralized control of data security
and access permissions. Users can be granted specific privileges to perform certain
operations on the data, ensuring that sensitive information is protected.
Data Scalability: Modern DBMSs are designed to handle large volumes of data and
can scale to meet the growing demands of data storage and processing. This makes it
suitable for applications that deal with vast amounts of data, such as big data analytics
and real-time processing.

Data Backup and Recovery: DBMS provides mechanisms for data backup and
recovery, allowing organizations to create copies of the database at different points in
time and restore it to a previous state in case of data loss or system failure.

10. What is significance of database models?

Database models play a crucial role in the design, implementation, and management of
databases. They provide a structured and systematic way to represent the data and its
relationships within the database, making it easier for users and developers to understand
and work with the data.

11. List the Database Models.


Hierarchical Model: Data in the hierarchical model is organized in a tree-like
structure with parent-child relationships. Each parent can have multiple children, but
each child has only one parent. It was commonly used in early database systems.

Network Model: Similar to the hierarchical model, the network model also represents
data with interconnected records. Records can have multiple parents and children,
forming a more complex graph-like structure.

Relational Model: The relational model is the most widely used database model
today. Data in the relational model is represented in tabular form, with rows as
records and columns as attributes. Relationships between entities are defined through
primary and foreign keys. Relational databases use SQL for data manipulation.

Entity-Relationship Model (ER Model): The ER model is a high-level data model


that uses entity-relationship diagrams to represent entities, attributes, and relationships
between entities. It is commonly used in database design and conceptual modeling.

Object-Oriented Model: The object-oriented model is designed to handle object-


oriented data, such as those used in programming languages. It represents data as
objects with properties and methods, allowing for seamless integration between
programming languages and databases.

Document Model: Document databases store data in a semi-structured or


unstructured format, typically using JSON or BSON documents. They are flexible and
suitable for handling dynamic and evolving data.
Graph Model: Graph databases use nodes, edges, and properties to represent data in
a graph-like structure. They are particularly well-suited for handling highly
interconnected data and complex relationships, making them useful in applications
like social networks and recommendation systems.

Columnar Model: The columnar model stores data in columns rather than rows,
making it highly efficient for analytical queries and data warehousing. It is optimized
for handling large volumes of data and aggregations.

Time-Series Model: Time-series databases are specialized databases optimized for


handling time-stamped data, such as IoT sensor data and monitoring data. They
efficiently store and retrieve data based on timestamps, enabling fast and flexible
time-based queries.

12. Explain 3-schema Architecture.

o The three schema architecture is also called ANSI/SPARC architecture or three-level


architecture.
o This framework is used to describe the structure of a specific database system.
o The three schema architecture is also used to separate the user applications and
physical database.
o The three schema architecture contains three-levels. It breaks the database down into
three different categories.

The three-schema architecture is as follows:


In the above diagram:

o It shows the DBMS architecture.


o Mapping is used to transform the request and response between various database
levels of architecture.
o Mapping is not good for small DBMS because it takes more time.
o In External / Conceptual mapping, it is necessary to transform the request from
external level to conceptual schema.
o In Conceptual / Internal mapping, DBMS transform the request from the conceptual
to internal level.

13. What are the DBMS languages and Interfaces ?


Database Languages
Database languages are used to read, store and update the data in the database.
Specific languages are used to perform various operations of the database.
Types of Database Languages

DDL(Data Definition Language)


Data Definition Language(DDL) is used for describing structures or patterns and its
relationship in a database. It is also used to define the database schema, tables, index,
Constraints, etc. It can also be used to store information like the number of tables,
names, columns, indexes, etc. The commands only affect the database structure and
not the data.

The commands used in DDL are:

Create: It is used to create a database or table.

Alter: It is used to make a change in the structure of a database.

Drop: It is used to completely delete a table from the database

Rename: It is used to rename a table.


Truncate: It is used to delete the entities inside the table while holding the structure
of the table.

Comment: It is used to comment on the data dictionary.

DML(Data Manipulation Language)


DML is used to manipulate the data present in the table or database. We can easily
perform operations such as store, modify, update, and delete on the database.

The commands used in DML are:

Select: It shows the record of the specific table. Also, it can be used with a WHERE
clause to get the particular record.

Insert: It allows users to insert data into the database or tables.

Update: It is used to update or modify the existing data in database tables.

Delete: It is used to delete records from the database tables. Also, it can be used with
a WHERE clause to delete a particular row from the table.

Merge: It allows the insert and update(UPSERT) operations.

DCL(Data Control Language)


DCL works to deal with SQL commands that are used to permit a user to access,
modify and work on a database. it is used to access stored data. It gives access,
revokes access, and changes the permission to the owner of the database as per the
requirement.

The commands used in DCL are:

Grant: It is used to give access to security privileges to a specific database user.

Revoke: It is used to revoke the access from the user that is being granted by the
grant command.

TCL(Transaction Control Language)


It can be grouped into a logical transaction and is used to run the changes made by the
DML command in the database.

Commit: Transaction on the database is saved using Commit.


Rollback: The database gets restored to the original since the last commit.

Interface
An interface is a program that allows users to input queries into a database without
writing the code in the query language. An interface can be used to manipulate the
database for adding, deleting, updating, or viewing the data.

Types of Interface are


Form−based Interface
A form is displayed to each user by the form−based interface. The user fills in the
details and submits the form to make a new entry into the database. It can also be
done when the user only fills in some details and the system will help by retrieving
the rest of the details from the database. The form−based interface is built for the
naive user(inexperienced user) which deals with a limited number of operations.
Many DBMS have specification language which helps the programmer define such
forms.

Example

Student entering his roll. no, branch in the form to get the grade card.

Menu−based User Interface


In this interface, the user was provided with a list of options (called a menu) through
which the user forms a request. The user doesn’t need to memorize the command and
syntax and the query is composed step by step by picking options from a menu.
Pull−down menu interfaces are mostly used in web−based user interfaces and are
often used in browsing interfaces by which the database content can be looked
through.

Example

In a shopping website, categories are selected from the menu, brands are selected
from the menu of brands, and budget ranges are applied from the menu of budget
range.

GUI(Graphical User Interface)


Users are provided a schema of diagrammatic form by which query can be specified
through manipulating the diagram. GUI utilizes both menu and form in several cases.
Schema Diagram's specific parts are selected using devices used by GUI.

Example

You liked a video on Instagram by tapping with your finger, and the color changes to
red. The visual graphic gets changed due to user action.
Natural Language Interface
A natural language interface contains its unique schema more like the high−level
conceptual schema. It also has a directory of important words. It generates a query
based on the interpretation of important words in the input by the user and if the
interpretation is successful, then it displays the result to the user.

Example

A user googled the fastest car in India, and now the natural language interface will
look for the important words i. e. fastest, car, India, and show the result accordingly.

Speech Input and Output


The users query the interface with speech and get the answer in speech. The input is
detected using predefined words and conversions are done into speech to provide the
output. Nowadays, it has become the most common type of interface.

Example

OK Google, Siri on Apple, and Alexa is used in the form of speech.

Interface for DBA


DBA staff are provided commands that can only be used by them only to create an
account, grant account authorization, and change a schema, and storage structure
reorganization.
14. Explain the different types of Database users
Users may be divided into
Those who actually use and control the database content, and those who design,
develop and maintain database applications (called “Actors on the Scene”), and
Those who design and develop the DBMS software and related tools, and the
computer systems operators (called “Workers Behind the Scene”).
Actors on the scene
Database administrators
Responsible for authorizing access to the database, for coordinating and monitoring
its use, acquiring software and hardware resources, controlling its use and monitoring
efficiency of operations.
Database designers
Responsible to define the content, the structure, the constraints, and functions or
transactions against the database. They must communicate with the end-users and
understand their needs.
Database End Users
Sophisticated:
These include business analysts, scientists, engineers, others thoroughly familiar with
the system capabilities.
Many use tools in the form of software packages that work closely with the stored
database.
Stand-alone:
Mostly maintain personal databases using ready-to-use packaged applications.
An example is the user of a tax program that creates its own internal database.
Another example is a user that maintains a database of personal photos and videos.

Database Users – Actors behind the Scene

System designers and implementers: Design and implement DBMS packages in the
form of modules and interfaces and test and debug them. The DBMS must interface
with applications, language compilers, operating system components, etc.

Tool developers: Design and implement software systems called tools for modeling
and designing databases, performance monitoring, prototyping, test data generation,
user interface creation, simulation etc. that facilitate building of applications and
allow using database effectively.

Operators and maintenance personnel: They manage the actual running and
maintenance of the database system hardware and software environment.

15. Explain the components of ER Diagram

ER Model consists of Entities, Attributes, and Relationships among Entities in a


Database System.

Components of ER Diagram
Entity
An Entity may be an object with a physical existence – a particular person, car, house,
or employee – or it may be an object with a conceptual existence – a company, a job,
or a university course.
Entity Set: An Entity is an object of Entity Type and a set of all entities is called an
entity set. For Example, E1 is an entity having Entity Type Student and the set of all
students is called Entity Set. In ER diagram, Entity Type is represented as:

Entity Set
1. Strong Entity
A Strong Entity is a type of entity that has a key Attribute. Strong Entity does not
depend on other Entity in the Schema. It has a primary key, that helps in identifying it
uniquely, and it is represented by a rectangle. These are called Strong Entity Types.
2. Weak Entity
An Entity type has a key attribute that uniquely identifies each entity in the entity set.
But some entity type exists for which key attributes can’t be defined. These are
called Weak Entity types.
For Example, A company may store the information of dependents (Parents, Children,
Spouse) of an Employee. But the dependents don’t have existed without the employee.
So Dependent will be a Weak Entity Type and Employee will be Identifying Entity
type for Dependent, which means it is Strong Entity Type.
A weak entity type is represented by a Double Rectangle. The participation of weak
entity types is always total. The relationship between the weak entity type and its
identifying strong entity type is called identifying relationship and it is represented by
a double diamond.

Strong Entity and Weak Entity


Attributes
Attributes are the properties that define the entity type. For example, Roll_No, Name,
DOB, Age, Address, and Mobile_No are the attributes that define entity type Student.
In ER diagram, the attribute is represented by an oval.

Attribute
1. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called the key
attribute. For example, Roll_No will be unique for each student. In ER diagram, the
key attribute is represented by an oval with underlying lines.

Key Attribute
2. Composite Attribute
An attribute composed of many other attributes is called a composite attribute. For
example, the Address attribute of the student Entity type consists of Street, City, State,
and Country. In ER diagram, the composite attribute is represented by an oval
comprising of ovals.

Composite Attribute
3. Multivalued Attribute
An attribute consisting of more than one value for a given entity. For example,
Phone_No (can be more than one for a given student). In ER diagram, a multivalued
attribute is represented by a double oval.

Multivalued Attribute
4. Derived Attribute
An attribute that can be derived from other attributes of the entity type is known as a
derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, the derived
attribute is represented by a dashed oval.

Derived Attribute
The Complete Entity Type Student with its Attributes can be represented as:
Entity and Attributes
Relationship Type and Relationship Set
A Relationship Type represents the association between entity types. For example,
‘Enrolled in’ is a relationship type that exists between entity type Student and Course.
In ER diagram, the relationship type is represented by a diamond and connecting the
entities with lines.

Entity-Relationship Set
A set of relationships of the same type is known as a relationship set. The following
relationship set depicts S1 as enrolled in C2, S2 as enrolled in C1, and S3 as registered
in C3.

Relationship Set
Degree of a Relationship Set
The number of different entity sets participating in a relationship set is called
the degree of a relationship set.
1. Unary Relationship: When there is only ONE entity set participating in a relation,
the relationship is called a unary relationship. For example, one person is married to
only one person.
Unary Relationship
2. Binary Relationship: When there are TWO entities set participating in a
relationship, the relationship is called a binary relationship. For example, a Student is
enrolled in a Course.

Binary Relationship
3. n-ary Relationship: When there are n entities set participating in a relation, the
relationship is called an n-ary relationship.
Cardinality
The number of times an entity of an entity set participates in a relationship set is
known as cardinality. Cardinality can be of different types:
1. One-to-One: When each entity in each entity set can take part only once in the
relationship, the cardinality is one-to-one. Let us assume that a male can marry one
female and a female can marry one male. So the relationship will be one-to-one.
the total number of tables that can be used in this is 2.

One-to-One Cardinality
Using Sets, it can be represented as:

Set Representation of One-to-One


2. One-to-Many: In one-to-many mapping as well where each entity can be related to
more than one relationship and the total number of tables that can be used in this is 2.

One to Many
Using sets, one-to-many cardinality can be represented as:
Set Representation of One-to-Many
3. Many-to-One: When entities in one entity set can take part only once in the
relationship set and entities in other entity sets can take part more than once in the
relationship set, cardinality is many to one. Let us assume that a student can take only
one course but one course can be taken by many students. So the cardinality will be n
to 1. It means that for one course there can be n students but for one student, there will
be only one course.
The total number of tables that can be used in this is 3.

Many-to-One Relationship
Using Sets, it can be represented as:

Set Representation of Many-to-One


In this case, each student is taking only 1 course but 1 course has been taken by many
students.
4. Many-to-Many: When entities in all entity sets can take part more than once in the
relationship cardinality is many to many. Let us assume that a student can take more
than one course and one course can be taken by many students. So the relationship will
be many to many.
the total number of tables that can be used in this is 3.
Many-to-Many
Using Sets, it can be represented as:

Many-to-Many Set Representation


In this example, student S1 is enrolled in C1 and C3 and Course C3 is enrolled by S1,
S3, and S4. So it is many-to-many relationships.
Participation Constraint
Participation Constraint is applied to the entity participating in the relationship set.
1. Total Participation – Each entity in the entity set must participate in the
relationship. If each student must enroll in a course, the participation of students will
be total. Total participation is shown by a double line in the ER diagram.
2. Partial Participation – The entity in the entity set may or may NOT participate in
the relationship. If some courses are not enrolled by any of the students, the
participation in the course will be partial.
The diagram depicts the ‘Enrolled in’ relationship set with Student Entity set having
total participation and Course Entity set having partial participation.

Total Participation and Partial Participation


Using Set, it can be represented as,
Set representation of Total Participation and Partial Participation
Every student in the Student Entity set participates in a relationship but there exists a
course C4 that is not taking part in the relationship.
16.

17. Draw and Explain the ER design for the company database

You might also like