Rdbms I Unit
Rdbms I Unit
1.1.1. ENTITIES:
Entities are the basic unit used in modeling classes of concrete objects. Entity is a thing in the real world with an independent
existence.
Example:
Building, room, chair, transaction, course, machine, employee.
1.1.3. ATTRIBUTES: An attribute is also referred to by the term data item, data element, data field,dataitem.
EMPLOYEE
Error:
Reference source not found
Domain: the set of possible values that a given attribute can have is called domain.
1.2. KEYS:
A key is a single attribute or combination of two or more attribute of an entity set that is used to identify one or more
instance (occurrence) of the set.
Example:
If we add additional attribute to a primary key the resulting combination would still uniquely identify an instance of the
entity set. Such key are called super key.
Eg: employee Number and Phone number
1.3. RELATIONSHIP:
The relationship set is used in data modeling to represent an association between entity set.
example:
Error: Reference source not found
EMPLOYEE EMPLOYEE-NO
DEPARTMENT EMPLOYEE
EMPLOYEE SALARY
ANSI-SPARC three-tier database architecture is shown in the figure. It consist of following three levels:
internal level
conceptual level or logical view
external level
The view at each level is described by a scheme. A scheme is an outline or plan that describes the records and relationships
existing in the view. It can be called as schema
At this level all the database entities and the relationship among them are included.
The conceptual view is defined by the conceptual schema
It describes records and relationships
This schema contains the methods of deriving objects from the objects in internal view
It indicates how the data will be stored and describes the data structure and access methods to be used by the
database.
The internal view expressed by the internal schema, which contains the definition of the stored record, the methods
of representing the data fields, and the access aids used.
6
The process of programming requests and results between the Internal, Conceptual & External levels are called mapping.
2. conceptual/internal mapping.
The external conceptual mapping defines the communication between a particular external view and the conceptual view.
It provide the communication among the records and relationship of the external and conceptual view.
The conceptual internal mapping defines the communication between the conceptual view and the storage database. or
internal view
It specifies how conceptual records and field are presented at the internal view.
In case of any changes in the structure of the stored database, the conceptual/internal mapping is also changed according
by the DBA.
n
4. DATA INDEPENDENCE:
Data Independence is the ability to modify a schema definition in one level without affecting a schema definition in the
next higher level.
There are two types of data independence the mapping at three tier architecture,
The ability to change the physical schema without changing the logical schema is called
physical data independence.
8
It indicates that the physical storage structure could be changed without a change in the conceptual view or any of the
external view.
For example, a change to the internal schema, such as using different file organization or storage structures, storage
devices, or indexing strategy, should be possible without having to change the conceptual or external schemas.
Modifications at this level are usually to improve performance.
The ability to change the logical (conceptual) schema without changing the External schema (User View) is called
logical data independence.
For example, the addition or removal of new entities, attributes, or relationships to the conceptual schema should be
possible without having to change existing external schemas or having to rewrite existing application programs.
In logical data independence, the user are shield from changes in the logical structure of the data.
Changes to the conceptual schema, such as additional and deletion of the entity, attribute, relationship, must be
possible without changing existing external schemas.
5. COMPONENTS OF DBMS:
The users of database system can be classified into the following groups,
1. Navie users
2. Online users
3. Application programmers
4. Database administration.
Users interact with the system with one of the application program that have been written previously.
9
Example:
A bank teller who needs to transfer, this program asks the teller for the amount of money to the transferred the account
from which the money is to be transferred, and the account to which the money is to be transferred.
These are users who may communicate with the database directly via an online terminal or indirectly via a user
interface and application program.
Application programs are computer professional who interact with the system through DML calls which are embedded
in a program written in a host language
Example:
COBOL, PL/I, PASCAL, C.
Centralized control of the database is exerted by a person or group of persons under the supervision of a high-level
administrator.
He is responsible for external view, definition and implementation of internal view and also conceptual view
He is responsible for granting permission to the users of the database and stores theprofile of each user in the
database
They are the users who are most familiar with the database and are responsible for creating, modifying and
maintaining, its three levels,
6. DBMS FACILITIES:
Data manipulation involves retrieval of data from the database, insertion of new data into the database or deletion or
modification of existing data.
A query is a statement in the DML that requests the retrieval of data from the database.
7. STRUCTURE OF DBMS:
Data Manager
File Manager
It is responsible for the structure of files and managing the file space
It also responsible for locating the block containing the required record , requesting the block from the disk manager and
transmitting the required record to the data manager
12
Disk Manager
It is a part of Os
All input and output operations are performed by it
The disk manager transfers the block or page requested by the file manager
Query Processor
It is used to interpret the online user’s query and convert it into an efficient series of operation in a form capable of
being sent to the data manager for execution
It makes use of data dictionary to find the structure of relevant portion of the database and uses this information
Data Files
Data files contain the data portion of the database
Data Dictionary
1. Reduction Of Redundancies.
2. Shared Data
3. Integrity
4. Security
5. Conflict Resolution
6. Data Independence
REDUCTION OF REDUNDANCIES:
Centralized control of data by the DBA to avoids the unnecessary duplication of data.
It also eliminates the extra processing necessary to trace the required data in a large mass of data.
SHARED DATA:
A database allows the sharing of data under its control by any number of application programs or users.
INTEGRITY:
Data integrity means that the data contained in the database is both accurate and consistent.
Data values being entered for storage could be checked to ensure that they fall within a specified range.
Example:
The value of the age of an employee may be in the range of 16 and 75.
SECURITY:
14
CONFLICT RESOLUTION:
Since the database is under the control of DBA she/he should resolve the conflicting requirements of various users and
applications.
DATA INDEPENDENCE:
It consider from two point of view.
1. physical data independence
2. logical data independence.
Logical data independence indicates that the conceptual schema can be changed without affecting the existing external
schema.
8.2. DISADVANTAGES:
1. problems associated with centralization.
2. cost of software or hardware and migration.
3. complexity of backup and recovery.
Entity or objects of interest are represented by records that are stored together in files.
Relationship between objects are represented by using directories of various kinds.
15
The database structure employing the ER model is usually shown pictorially using .
BORROWER
CUSTOMER LOAN
16
Entities
An entity is an objects that is of interest to an organization. An entity often represents a group of people (eg children,
applicants, stakeholders) but it can also represent a group of objects (eg textbooks), activities (eg assignments) or concepts (eg school
terms).
Entities set:
Objects of similar are characterized by the same set of attributes or properties . such similar objects form entity set or
entity type. Or An entity set is a set of entities of the same type that share the same properties.
Example: set of all persons, companies, trees, holidays
Empdoj
Designation
Emp-id
Designation
17
A relationship is a binary relationship it the number of entity set involves in the relationship is two.
A relation that involves N entities is called N-any relationship.
Defintion :
Given the entity sets E1,E2……., Ek not necessarily distinct , then the relationship R is a subset of the set defined as
EMPLOYEE:
EMP-NO NAME SKILLS
12345 John Waiter
12346 Kumar Busboy
12347 Go Bell boy
12348 Suresh Hosters
Date shift
duty allocate
EMPLOYEE position
EMPLOYEE:
EMP-NO NAME SKILL
POSITION:
POSITON-NO SKILL
321 Waiter
322 Bus boy
DUTY ALLOCATION:
POSITION-NO EMP NO DATE SHIFT
11.1 GENERALIZATION:
19
Abstract is the simplification mechanism used to hide superfluous details of a set of object it allows one to
concentrate on the properties that are of inters to the application
Eg: Car is an abstraction of vehicle but does not reveal details about model, year, color etc
Two main abstraction mechanism are generalization of aggregation;
Generalization is the process of identifying some common characteristic of a collection of entity set and creating a new
entity set.
Example:
Vehicle-id
Max speed CAR
Licence no
price
model Vehicle-id
The above two entity type namely CAR, TWO-WHEELER is generalization to vehicle type.
MODEL PRICE
VEHICLE
CAR TWO-
WHEELER
20
No_of Paseenger
Registration
11.2 AGGREGATION:
Aggregation is the process of compiling the information in an object there by abstracting a higher level object
In this manner the entity person is derived by aggregation the characteristic name, address and social security
number.
Example of aggregation:
PERSON
Another form of aggregation is abstracting a relationship between objects and viewing the relationship as an object
REGISTRATION
ENROLLMENT
STUDENT COURSE
ENROLLMENT relationship between entities student and course could be viewed as entity REGISTRATION
21
The relational data model uses a collection of tables to represent both data and the relationship among those
data.
In this model relation is the only construct required to represent the association among the attributes of an
entity as well as the relationship among different entities
A relation may be visualized as a named table eg: customer and account
Rows of the relation are referred as tuples and the column are its attributes
Each attribute has distinct name
The value for an attribute is called as domain
Each table has multiple columns and each columns has a unique name.
Example:
customer:
Account:
ACC-NO BALANCE
A-101 500
A-215 700
A-102 400
22
a-201 900
For example:
Here two are identical and the ordering of the rows is not significant
That customer Johnson with social security number 192-183, lives on paloatlto and has two account A-101, with a
balance of $500, and A-201 with a balance of $900.
Example:
23
A-101 500
A-215 700
A-102 400
A-201 900
Hierarchical Database model is one of the oldest database models. This model is like a structure of a tree with the records
forming the nodes and fields forming the branches of the tree.
The hierarchical model is similar to the network model in the sense that data and relationship among data are represented
by records and links respectively.
It differs from the network model in that the records are organized as collections of trees rather than arbitrary graphs.
COMPARISON:
24
The hierarchical data model :The hierarchical data model organizes data in a tree structure.
There is a hierarchy of parent and child data segments.
This structure implies that a record can have repeating information, generally in the child data segments.
Data in a series of records, which have a set of field values attached to it.
It collects all the instances of a specific record together as a record type.
These record types are the equivalent of tables in the relational model, and with the individual records being the
equivalent of rows.
To create links between these record types, the hierarchical model uses Parent Child Relationships.
These are a 1:N mapping between record types.
This is done by using trees, like set theory used in the relational model, "borrowed" from maths.
------------------------------------------------------------------------------------------------------------------------------------------------------