Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Unit1 rdbms study_materials
1. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page1
Pondicherry University Community College
Department of Computer Science
Course : B.Voc [Software Development]
Year : II
Semester : III
Subject : Relational DataBase Management System
Unit I Study Materials and Model Questions
Prepared by
D.GAYA
Assistant Professor,
Department of Computer Science,
Pondicherry University Community College,
Lawspet, Puducherry-08.
2. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page2
Unit I
Unit - I
Introduction to Database System – Objectives – Entities and Attributes – Data Models.
Introduction to DataBase System
Introduction
A database is an organized collection of data, generally stored and accessed
electronically from a computer system. The term "database" is also used to refer to any of the
DBMS, the database system or an application associated with the database.
Because of the close relationship between them, the term "database" is often used
casually to refer to both a database and the DBMS used to manipulate it.
A school class register is a database where names are arranged alphabetically.
Databases have been around since people started recording things. Here we tend to focus on
electronic ones.
Data
Data are raw facts stored in a computer. A data may contain any character, text, word
or a number.
Example : 600006, DPI Campus, SCERT, Chennai, College Road
Information
Information is formatted data, which allows to be utilized in a significant way.
DataBase
Database is a repository collection of related data organized in a way that data can be
easily accessed, managed and updated. Database can be a software or hardware based, with
one sole purpose of storing data.
DataBase Management System
A DBMS is software that allows us to create, define and manipulate database,
allowing users to store, process and analyze data easily.
3. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page3
DBMS provides us with an interface or a tool, to perform various operations to create
a database, storing of data and for updating data, etc.
DBMS also provides protection and security to the databases. It also maintains data
consistency in case of multiple users.
Characteristics of Database Management System
Data Stored into Table
Data is never directly stored into the database. Data is stored into tables, created
inside the database. DBMS also allows to have relationship between tables which makes the
data more meaningful and connected.
Reduced Redundancy
In the modern world hard drives are very cheap, but earlier when hard drives were too
expensive, unnecessary repetition of data in database was a big problem But DBMS follows
Normalisation which divides the data in such a way that repetition is minimum.
Data Consistency
On live data, it is being continuously updated and added; maintaining the consistency
of data can become a challenge. But DBMS handles it by itself.
Support multiple user and concurrent Access
DBMS allows multiple users to work on it(update, insert, delete data) at the same time
and still manages to maintain the data consistency.
Query Lanaguage
DBMS provides users with a simple query language, using which data can be easily
fetched, inserted, deleted and updated in a database
Security
The DBMS also takes care of the security of data, protecting the data from
unauthorized access. In a typical DBMS, we can create user accounts with different access
permissions, using which we can easily secure our data by restricting user access.
DBMS Support Transaction
It allows us to better handle and manage data integrity in real world applications
where multi-threading is extensively used.
4. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page4
Advantages of DBMS
• Segregation of application program
• Minimal data duplication or Data Redundancy
• Easy retrieval of data using the Query Language
• Reduced development time and maintenance
Data Structure
Table is the entire collection of related data in one table, referred to as a File or Table
where the data is organized as row and column.
Each row in a table represents a record, which is a set of data for each database entry.
Each table column represents a Field, which groups each piece or item of data among
the records into specific categories or types of data. Eg. StuNo., StuName, StuAge, StuClass,
StuSec.
• A Table is known as a RELATION
• A Row is known as a TUPLE
• A column is known as an ATTRIBUTE
5. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page5
Entities and Attributes
An Entity–relationship model (ER model) describes the structure of a database with
the help of a diagram, which is known as Entity Relationship Diagram (ER Diagram).
An ER model is a design or blueprint of a database that can later be implemented as a
database. The main components of E-R model are: entity set and relationship set.
What is an ER DIAGRAM?
An ER diagram shows the relationship among entity sets. An entity set is a group of
similar entities and these entities can have attributes. In terms of DBMS, an entity is a table
or attribute of a table in database, so by showing relationship among tables and their
attributes, ER diagram shows the complete logical structure of a database. Let’s have a look
at a simple ER diagram to understand this concept.
A simple ER Diagram:
In the following diagram we have two entities Student and College and their
relationship. The relationship between Student and College is many to one as a college can
have many students however a student cannot study in multiple colleges at the same time.
Student entity has attributes such as Stu_Id, Stu_Name & Stu_Addr and College entity has
attributes such as Col_ID & Col_Name.
6. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page6
Components of a ER
As shown in the above diagram, an ER diagram has three main components as
follows
1. Entity
2. Attribute
3. Relationship
1. Entity
An entity is a “thing” or “object” in the real world that is distinguishable from all other
objects. For example, each person in an enterprise is an entity. An entity has a set of properties, and
the values for some set of properties may uniquely identify an entity.
An entity set is a set entity set of entities of the same type that share the some properties,
or attributes. The set of all persons who are customers at a given bank, for example, can be defined
as the entity set customer.
An entity can be a person, place, event, or object that is relevant to a given system.
• Weak Entity: The entity set which does not have sufficient attributes to form a Weak Entity
Primary key is called as Weak entity. Member of weak entity set is called as
Subordinate entity.
• Strong Entity: An entity set that has a primary key is called as Strong entity. A
Member of a strong entity set is called dominant entity.
An entity is an object or component of data. An entity is represented as rectangle in an
ER diagram. For example: In the following ER diagram we have two entities Student and
College and these two entities have many to one relationship as many students study in a
single college. We will read more about relationships later, for now focus on entities.
7. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page7
Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the
relationship with other entity is called weak entity. The weak entity is represented by a
double rectangle.
For example – a bank account cannot be uniquely identified without knowing the
bank to which the account belongs, so bank account is a weak entity.
2. Attribute
An attribute describes the property of an entity. An attribute is represented as Oval in
an ER diagram. There are four types of attributes:
1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute
1. Key attributes:
A key attribute can uniquely identify an entity from an entity set. For example,
student roll number can uniquely identify a student from a set of students. Key attribute is
represented by oval same as other attributes however the text of key attribute is underlined.
8. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page8
2. Composite attribute:
An attribute that is a combination of other attributes is known as composite attribute.
For example, In student entity, the student address is a composite attribute as an address is
composed of other attributes such as pin code, state, country.
3. Multivalued attribute:
An attribute that can hold multiple values is known as multivalued attribute. It is
represented with double ovals in an ER Diagram. For example – A person can have more
than one phone numbers so the phone number attribute is multivalued.
4. Derived attribute:
A derived attribute is one whose value is dynamic and derived from another attribute.
It is represented by dashed oval in an ER Diagram. For example – Person age is a derived
attribute as it changes over time and can be derived from another attribute (Date of birth).
E-R diagram with multivalued and derived attributes:
9. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page9
3. Relationship
A relationship is represented by diamond shape in ER diagram; it shows the
relationship among entities. There are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
1. One to One Relationship
When a single instance of an entity is associated with a single instance of another
entity then it is called one to one relationship. For example, a person has only one passport
and a passport is given to one person.
2. One to Many Relationship
When a single instance of an entity is associated with more than one instances of
another entity then it is called one to many relationship. For example – a customer can place
many orders but a order cannot be placed by many customers.
3. Many to One Relationship
When more than one instances of an entity is associated with a single instance of
another entity then it is called many to one relationship. For example – many students can
study in a single college but a student cannot study in many colleges at the same time.
10. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page10
4. Many to Many Relationship
When more than one instances of an entity is associated with more than one instances
of another entity then it is called many to many relationship. For example, a can be assigned
to many projects and a project can be assigned to many students.
Data Model
Data models define how the logical structure of a database is modified. Data models
are fundamental entities to introduce abstraction in DBMS.
Data models define how data is connected to each other and how they are processed
and stored inside the system.
Within the database environment, a data model represents data structures and their
characteristics, relations, constraints, transformations, and other constructs with the purpose
of supporting a specific problem domain.
Data models can facilitate interaction among the designer, the applications
programmer, and the end user.
A well-developed data model can even foster improved understanding of the
organization for which the database design is developed. In short, data models are a
communication tool.
Types of Data Model
Following are the different types of a Data Model
• Hierarchical Model
• Relational Model
• Network Database Model
• Entity Relationship Model
• Object Model
11. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page11
Hierarchical Model
Hierarchical model was developed by
IBM as Information Management System. In
Hierarchical model, data is represented as a
simple tree like structure form.
This model represents a one-to-many
relationship i.e. parent-child relationship. One
child can have only one parent but one parent can
have many children. This model is mainly used in
IBM Main Frame computers.
Relational Model
The Relational Database model
was first proposed by E.F. Codd in
1970. Nowadays, it is the most
widespread data model used for
database applications around the world.
The basic structure of data in
relational model is tables (relations).
All the information’s related to a
particular type is stored in rows of that
table.
Hence tables are also known as
relations in a relational model. A
relation key is an attribute which uniquely identifies a particular tuple (row in a relation
(table)).
Network Model
Network database model is an
extended form of hierarchical data model.
The difference between hierarchical and
Network data model is :
12. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page12
In hierarchical model, a child record has only one parent node,
In a Network model, a child may have many parent nodes. It represents the data in
many-to-many relationships. This model is easier and faster to access the data. School
represents the parent node Library, Office and Staff room is a child to school (parent node)
Student is a child to library, office and staff room (one to many relationship)
Entity Relationship Model. (ER model)
In this database model,
relationship is created by dividing the
object into entity and its
characteristics into attributes.
It was developed by Chen in
1976. This model is useful in
developing a conceptual design for
the database. It is very simple and
easy to design logical view of data.
The developer can easily
understand the system by looking at
ER model constructed. Rectangle
represents the entities.
E.g. Doctor and Patient Ellipse represent the attributes E.g. D-id, D-name, P-id, P-
name. Attributes describes the characteristics and each entity becomes a major part of the
data stored in the database. Diamond represents the relationship in ER diagrams
Object Model
Object model stores the data in
the form of objects, attributes and
methods, classes and Inheritance.
This model handles more
complex applications, such as
Geographic information System (GIS),
scientific experiments, engineering
design and manufacturing. It is used in
file Management System.
It represents real world objects, attributes and behaviours. It provides a clear modular
structure.
It is easy to maintain and modify the existing code. An example of the Object model
is Shape, Circle, Rectangle and Triangle are all objects in this model.
13. D.GAYA, Assistant Professor, Department of Computer Science, PUCC.
Page13
• Circle has the attribute radius.
• Rectangle has the attributes length and breadth.
• Triangle has the attributes base and height.
• The objects Circle, Rectangle and Triangle inherit from the object Shape.
Unit I Important Questions
Two Mark Question
1. What is mean by DataBase?
2. Define data and Information?
3. What are the Characteristics available in DBMS?
4. What is mean by Reduced Redundancy
5. What is mean by Data Consistency
6. Advantages of DBMS?
7. Define Data Structure?
8. Define Entity Relationship?
9. What are the Components available in ER ?
10. Define Entity set?
11. Types of Entity?
12. Define Strong and Week Entity?
13. What is mean by Attributes?
14. What is mean by Relationship?
15. Types of Attributes?
16. Types of Relationship?
17. Define Data Model?
18. Define ER Diagram?
19. Types of data Model?
20. Define ER model?
Five Marks
21. Describe DBMS?
22. Describe Attributes Types?
Describe types of Relationship?
23. Describe Data structures?
24. Describe ER model and Network Model?
Ten Marks
25. Explain Characteristics of DBMS?
26. Explain Entity and Attributes?
27. Explain Data Model?