Giyaz Ppts Dbms
Giyaz Ppts Dbms
From the earliest days of computer storing and manipulating data have been a
major application.
The first general purpose DBMS designed by ―Charles Bachman ‖at general
electric in 1960‘s was called ―Integrated Data Store‖.
Charles Bachman is the first person to develop the IDS( Integrared Data
Store).which was based on network model.
In the late 1960‘s IBM developed the ― Integrated Management Systems ―
In 1970‘s the ― Relational Data Base model ― was developed by ― Edgar Codd ―
at IBM.
Many of the data base models we use today are Relational based.
It was developed as a standard language for the queries by ISO and ANSI .
1990s:
2000s:
Integrity problems
Example: Transfer of funds from one account to another should either complete
or not happen at all
Security problems.
File system is used to manage the data , dbms is also used to manage the data
File systems are for short amount of data as well as Dbms will consists huge data
File : A collection of records , where records contains fields, where field contains data
Data Inconsistency :Because of data redundancy , data inconsistency problem will occurs.
(no accurate data)
Data Isolation : when data of a file cannot be mapped with the related data of other file
Atomicity Issues : If the transaction involves two operations then we have to execute those
two operations at once in order to complete the transaction..
Data security :
File system vs DBMS
FILE SYSTEM DBMS
File system is a software that manages DBMS is a software for managing the data
and organizes the files in a storage with in base
a computer
There is no redundant data
Redundant data can be present in a file
system
It doesn't provide backup and recovery of It provides backup and recovery of data if
data if it is lost it is lost
There is no efficient query processing in a Efficient query processing is there in DBMS
file system
There is less data consistency in file
systems There is more data consistency because of
the process of normalization
It is less complex when compared to DBMS
It has more complexity
File system provides less security in
compared to DBMS DBMS has more security Mechanisms
Telecommunications Military
Online retailers
it is a data model in which the data is organized in the form of TREE structure
The structure represents information using parent – child relation ship
Here each parent can have many children and child has only single parent.
That is one to many relation ship
Advantages :
complex implementation
Difficult to manage
Structured dependency
It doesn‘t support many to many relationship
In a network data model one parent can have several children and a child can have
many parent records.
It follows GRAPH structure
Network model is extension to hierarchical data model.
Advantages :
Disadvantages :
As more and more relationships need to be handled the system might get complex
Entity relationship model:
It contains mainly three things
1.Entity
2.Attibutes
3.Relationships.
1.Entity :
Any real world thing , any thing that has physical existence is called entity
Example : student , faculty,…
2.Attributes :
3.Reltionships:
Relationship is manly use in order to connect two entities
1.one to one relationship 2. one to many relationship
3.many to one relationship 4.many to many relatioship
E-R Diagram for the Banking Enterprise
Features of ER Model:
Graphical design for better understanding : It is very easy to understand so it can be
used by the developers
Database design: This model helps the database designers to build the database
ER Diagram :ER Diagram is used as a visual tool for representing the model.
Advantages of ER Model:
Disadvantages of ER Model :
ATTRIBUTES
Simple : This model is more simple as compared to the network and hierarchical model.
Scalable : This model can be easily scaled as we can add as many rows and columns we want.
For hiding the complexities and making things easier for the use this model requires more
powerful hardware computers and storage devices.
As the relational model is very easy to design and use.
In this model both the data and relationship are present in a single structure known as object.
We can store audio ,video ,images ,etc in the database which is not possible in the Relational
model
Although you can store audio and video in relational database , it is advised not to store in the
relational database.
In this model, the attributes describe the properties of an object.
Object that share similar characteristics are grouped in classes.
Therefore, a class is a collection of similar objects model, two or more objects are
connected with the help of links.
We use the link to relate objects.
For example:
EMPLOYEE DEPARTMENT
ATTRIBUTES ATTRIBUTES
NAME DEPT_ID
PHONE NO. DEPT_NAME
SALARY METHODS
DEPT_ID Change department
METHODS
Change number
There are two data objects in the above example :
1.Employee
2.Department
Advantages:
Disadvantages :
it is complex navigation system
Slow development of standards
High system overheads
Slow transactions.
LEVELS OF ABSTRACTON :
Data abstraction is the process of hiding unwanted or irrelevant details from the end user
The database system consists of complicated data structures and relation.
For users to access the data easily, these complications are kept hidden, and only the
relevant part of the database is made accessible to the users through the data abstraction.
VIEW LEVEL
VIEW 1 ….
VIEW2 VIEW N
LOGICAL
LEVEL
PHYSICAL
LEVEL
Physical level:
Logical level:
View level :
Instances :
(OR)
The content of the database at a given point of time
It is a dynamic value which keeps on changing.
ROLL NO NAME MARKS
For ex: student table.
100 RAJU 90
101 RAMESH 85
102 MAHESH 95
This table contains 3 row i.e. instance of the table or instance of database
Schema :
If we change data or data structure in the database it will not modify the user
level instructions.(or) the ability to change the schema at one level without
changing the schema at another level is known as data independence.
If we change the data in the database these changes will not reflect above
levels of logical and view level
Note That: structure of Database management system is also referred as overall system structure
or Database Architecture but is different from the Tier Architecture of Database.
1.Query Processer
2. Storage Manager
3.Disk Storage
ER DIAGRAMS
The entity relationship diagram explains the relationship among the entities present in the
Database.
ER models are used to model real world objects like a person, a car, a company, and the
relation between these real world objects.
ER diagrams are used to represent the E-R model in a database, which make them easy to
Convert into relations(Tables).
ER diagrams require no technical knowledge and no hardware support
These diagrams are very easy to understand and easy to create even for a naïve user.
Attributes in ER Model
ELLIPSE
Relationship Among
DIAMOND Attributes
ER MODEL:
1.Entity.
Strong Entity
Weak Entity
2. Attributes.
Key Attributes
Composite Attributes
Multivalued Attributes
Derived Attributes
Simple Attribute.
Single Valued Attributes.
Relationship:
One to One
One to Many
Many to One
Many to Many
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:
1.Strong Entity:
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.
Attributes:
Attributes are the properties that define the entity type.
For example, RollNo, Name, DOB, Age, Address, and MobileNo are the attributes that define entity type Student.
In ER diagram, the attribute is represented by an oval.
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.
2. Composite 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.
The Complete Entity Type Student with its Attributes can be represented as:
Relationship Type and Relationship Set :
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.
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.
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.
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.
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.
It means that for one course there can be n students but for one student, there will be only one
course.
Generalization, Specialization, and Aggregation in ER model are used for data abstraction.
in which an abstraction mechanism is used to hide details of a set of objects.
Some of the terms were added to the Enhanced ER Model,
where some new concepts were added.
1.Generalization:
Generalization is the process of extracting common properties from a set of entities and
creating a generalized entity from it.
It is a bottom-up approach in which two or more entities can be generalized to a higher-level entity
if they have some attributes in common.
For Example, STUDENT and FACULTY can be generalized to a higher-level entity called PERSON as shown in Figure
In this case, common attributes like P_NAME, and P_ADD become part of a higher ENTITY (PERSON),
and specialized ATTRIBUTES like S_FEE become part of a specialized entity (STUDENT).
Generalization
Specialization:
In specialization, an entity is divided into sub-entities based on its characteristics.
It is a top-down approach where the higher-level entity is specialized into two or more lower-
level entities.
For Example, an EMPLOYEE entity in an Employee management system can be specialized into
DEVELOPER, TESTER, etc. as shown in Figure 2.
In this case, common attributes like E_NAME, E_SAL, etc. become part of a higher entity
(EMPLOYEE), and specialized attributes like TES_TYPE become part of a specialized entity
(TESTER).
Aggregation:
An ER diagram is not capable of representing the relationship between an
entity and a relationship which may be required in some scenarios.
Generalization is the higher level of understanding of data from lower levels of data whereas
Specialization is the process of defining one or more entities from present entities and Aggregation is the
process of combining two or more entities.
Generalization is simply gathering the common properties from entities and creating a generalized
concept from those extracted data. Generalization helps in improving the flexibility, and reusability of
the database.
Generalization is important in the database because it helps to gather important information so that it
becomes easier and faster for the user the analysis of data and it also helps in making decisions faster.
ORACLE :
In database management system the user can interact with the database system
by using database language
Here we are using oracle in that the mainly used components are
SQL (Structured Query Language)
PL/SQL (Procedural language / SQL Commands )
SQL comprises mainly three languages :
EXAMPLES:
Describe syntax :
Describe<tablename>
Syntax:
SQL>insert into <tablename>values (<col1 value>,<col2 value>,<col3 value>…);
EXAMPLE:
Syntax:
Insert into <tablename>values(<&col1>,<&col2>,<&col3>);
EXAMPLE:
TRUNCATE SYNTAX :
Note: that using truncate only table record will be deleted, not a table.
Example:
SQL>select * from employee;
NAME ADDRESS
rahal Khammam
Kiran hyderabad
Example:
SQL>select * from employee;
NAME ADDRESS
rahul Khammam
Kiran Hyderabad
SELECT COMMAND:
It is used to retrieve the data from the database table