DBMSIntroduction - Free Stuff Jamaica
Download
Report
Transcript DBMSIntroduction - Free Stuff Jamaica
DataBase Management System
What is DBMS
Purpose of DBMS
Data Abstraction
Data Definition Language
Data Manipulation Language
Data Models
Data Keys
Relationships
Normalization
DBMS
Consists of
Database - Collection of interrelated data
And a set of programs to access that data
Database Systems are designed to manage large
bodies of information
Management of data involves
the definition of structures for the storage of
information
the provision for mechanisms for the storage
of information
Characteristics of DBMS
Centralized control of its its data
Shared – shared among different users and
applications
Controlled Redundancy and Inconsistency
Data Redundancy
Duplication of information
Leads to higher storage and access cost
Inconsistency
Various copies of same data may no longer
agree
Accessing data
Data access depending on some criteria
Minimizing the Security problems
Not every user of the database system should
be able to access all the data
Integrity constraints
The data values stored in the database must
satisfy certain type of consistency constraints
When new constraints are added, it is
difficult to change the programs to enforce
them
DBMS overcomes all these difficulties
Data Abstraction
Major purpose of DBMS is to provide
users with an abstract view of the data
I.e hiding certain details of how the data is
stored and maintained
The complexity is hidden from users
through levels of abstraction in order to
simplify their interaction with the system
Data Abstraction – three levels
Physical level
Lowest level of abstraction
Describes how the data actually stored
Complex low-level data structures are described in
detail
Conceptual level
Describes what data are actually stored in the database
and the relationships that exist among the data
The entire database is described in terms of a small
number of relatively simple structures
Conceptual level of abstraction is used by database
administrator, who must decide what information is to
be kept in the database
View Level
Highest level of abstraction
Describes only the part of the entire
database
Users who need a part of the database
information will come in this level
The system may provide many views for
the same database
Data Definition Language
Is used to create, alter and delete the database objects
Depends on the DBMS package
After we design the database we must write the DDL
The result of the compilation of DDL statements is a set
of tables which are stored in a special file called data
dictionary
Data dictionary – is a file that contains data about
data(meta data)
The result of these definitions is a set of instructions to
specify the implementation details of the database
schemes which are usually hidden from the users
Data Manipulation Language
DML is a language that enables users to access
or manipulate data as organized by the
appropriate data model
The retrieval of information stored in the
database
The insertion of new information into the
database
The deletion off information from the database
The modification of data stored in the database
Data Models
A collection of conceptual tools for describing
data relationships, data semantics, and
consistence constraints
The underlying concept of the structure of
database
Database defines a data model as one of the three
traditional forms for the organization of the data
Object-Based Logical Model, Record-Based
Logical Model, the Hierarchical Model
Object-Based Logical Models
Entity-Relationship Model
Is based on a perception of a real world consists
of a collection of basic objects called entities
and relationships among these objects
Entity – an object that is distinguishable from
other objects by a specific set of attributes
Relationship – an association among several
entities
EntitySet – set of all entities of same type
RelationshipSet – set of all relationships of same
type
Record-Based Logical Model
Relational Model
The database is structured in fixed-format
records of several types
Represents data and relationships among data by
a collection of tables
Each table corresponds to an entity
Table – collection of columns with unique names
Relationships links rows from two tables by
embedding keys from one table to another
Hierarchical Model
Data are represented by collection of records
and relationships among data are represented by
links, which can be viewed as pointers
The records in the database are organized as
collections of trees
In hierarchy, files rank from top to bottom, with
higher level files being the parents of lower files
A file may have several child files, but each
child file may have only one parent
Data Keys
A key - is single attribute or combination of
two are more attributes of an entity that is to
identify one or more instances of a set
Primary Key – an attribute, which is unique
and can identify an instance of the entity
Composite keys / Candidate Keys – the group
of attributes acting as a primary key
Foreign key – An attribute in one table whose
value matches the primary key in some other
table
Relationships
Is an association among instances of one or more
entity types is of interest to the organization
One-to-One Relationship
One-to-Many Relationship
Hierarchical Model
Many-to-One Relationship
Hierarchical Model
Network Model
Many-to-Many Relationship
Network Model
Normalization
Reducing the tables into small tables
without unnecessary data redundancy,
without loss of information and for easy
retrieval of information
So the database is designed to generate
such set of relation schemes
First Normal Form ( 1NF )
A relation in 1NF contains no multi-valued
attributes
A repeating group of columns should be
eliminated from the table
Steps for 1NF :
To eliminate the repeating group, the group
is moved to another table, which is then
related to the parent table
The primary key of the parent table is stored
in the second table
Second Normal Form ( 2NF )
A relation is in 2NF if it is in 1NF and every
non-key attribute is functionally dependent on
the primary key
A relation in the 2NF if any one of the following
conditions apply
Primary key consists of only attribute
No non-key attribute exists in the relation
Every non-key attribute is functionally
dependent on the primary key
Third Normal Form ( 3NF )
A 3NF is one which is in 2NF and no
transitive dependencies exist
A transitive dependency in a relation is
functional dependency between two or more
non-key values
Steps
Find the non-keys involved in transitive
dependency
Construct an other table