0% found this document useful (0 votes)
17 views28 pages

DB Concepts

hi my name is muhammad ali

Uploaded by

itsaligulzar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views28 pages

DB Concepts

hi my name is muhammad ali

Uploaded by

itsaligulzar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Basic Database Concepts

Lecture-2

1
Objectives
• Basic Concepts & Architecture
• History
• DBMS Benefits
• DBMS Abstraction
• Database Schema and State

2
History of Database Systems
• First-generation
o Hierarchical and Network

• Second generation
o Relational

• Third generation
o Object Relational
o Object-Oriented

3
Non-Relational Systems
• Database systems can be conveniently
categorized according to the data structures and
operators they present to the user
• The oldest system fall into three broad categories:
o Flat-File Systems
o Hierarchical Systems
o Network Systems
• We will not discuss these categories in great detail
as, although some are still used, they are obsolete
• We will focus on relational databases

4
Flat-File Systems
• The file system was a start. However, it was seriously inefficient
o Essentially, in order to find a record, someone would have
to read through the entire file and hope it would not be the
last record
o Imagine last record is the required one…
• What was needed, computer scientist thought, was a “card
catalog”, a mean to achieve the ability to efficiently access a single
record without searching the entire file to find it
• So the result was the “indexed file-oriented systems” in which a single
index file stored “key” words and pointers to records that were
stored else where. This made retrieval much more easier.

• But How???
o To find data, one needed only search for keys rather than
reading entire records.
o This was referred to as “flat-file systems”
5
Files, Records, and Fields

6
Indexed Files

7
Flat-File Systems (Cont…)
• Even with the benefits of indexing, the file-
oriented systems still suffered from problems
discussed before
o Data Redundancy - the same data might be stored
in different places
o Poor Data Control - redundant data might be slightly
different such as in the case when XYZ changes his
city and the change is only reflected in some of the
files containing his data
o Inability to Easily Manipulate Data - it was a tedious
and error prone activity to modify files by hand

8
Terms and Concepts
• Data Independence
o Physical representation and location of data and
the use of that data are separated
• The application doesn‟t need to know how or
where the database has stored the data, but just
how to ask for it

• Moving a database from one DBMS to another


should not have a material effect on application
program

• Recording, adding fields, etc in the database


should not affect applications
9
Three-Level ANSI-SPARC Architecture
• DBTG (Database Task Group) proposed first two
level architecture approach in 1971 – system
view called schema and a user view called
subschema
• American National Standards Institute (ANSI)
Standards Planning and Requirements
Committee (SPARC) produced similar
terminology/architecture in 1975
• Later, ANSI-SPARC recognized the need for a
three-level approach –- with an
implementation - independent layer to isolate
programs from underlying representational
issues … 10
Objectives of Three-Level
Architecture
• All users should be able to access same
data

• The user‟s view is immune to change made


in other views

• User should not need to know physical


database storage details – like hashing,
indexing techniques etc…

11
Objectives of Three-Level Architecture
• DBA should be able to change database
storage structures without affecting the user‟s
views
• Internal structure of database should be
unaffected by changes to physical aspects of
storage – change to a new storage device …
• DBA should be able to change conceptual
structure of database without affecting all
users

12
ANSI-SPARC Three-Level Architecture

13
ANSI-SPARC Three-Level Architecture
• External Level
o User‟s view of the database
o Describes that part of database that is relevant to a
particular user (e.g. different date representations,
age using DoB….)
o Includes only those entities, attributes, relationships
in “real world” that user is interested in …

• Conceptual Level
o Community view of the database
o Describes what data is stored in database and
relationships among the data
o Contains logical structure of entire DB as seen by
DBA 14
ANSI-SPARC Three-Level Architecture
o The conceptual level represents:
• All entities, attributes and their relationships
• The constraints on the data
• Semantic information about data
• Security and integrity information

• Internal Level
o Physical representation of the database on the
computer
o Describes how the data is stored in the database
o Internal level is concerned with:
• Storage space allocation for data
• Data compression and encryption techniques etc…
15
Differences between Three Levels of ANSI-
SPARC Architecture

16
-- Database Schema
• It is the description of a database
• It is specified during the database design and
is not expected to change frequently.
• It is represented as a diagram called schema
diagram.
o A schema diagram displays the structure of
each record type but not the actual
instance of a record.
• Each object in a schema is called a schema
construct.
17
Data Independence
• Logical Data Independence
o Refers to immunity of external schemas to changes in
conceptual schema
o Conceptual schema changes (e.g. addition/removal of
entities and/or relationships) should not require changes
to external schema or rewrites of application programs

• Physical Data Independence


o Refers to immunity of conceptual schema to the
changes in internal schema
o Changes in internal schema like using different file
organizations or storage structures, modifying
indexes, hashing algos etc should not require
changes in conceptual or external schema

18
Data Independence and the ANSI-SPARC
Three-Level Architecture

19
-- Database Schema
• It is the description of a database
• It is specified during the database design and
is not expected to change frequently.
• It is represented as a diagram called schema
diagram.
o A schema diagram displays the structure of
each record type but not the actual
instance of a record.
• Each object in a schema is called a schema
construct.
20
Schemas and Instances
• Similar to types and variables in programming languages
• Schema – the logical structure of the database – overall
description of the database
o E.g., the database consists of information about a set of
customers and accounts and the relationship between
them
o Three different types of schema according to levels of
abstraction of three-level architecture …
o Sub-Schemas/external schemas: there may be several
of these at the view level, each providing a different
view of database
o Physical/internal schema: database design at the
physical level – complete description of internal model:
definition of stored records, methods of representations, data
fields, indexes etc…
21
Schemas and Instances
o Logical/conceptual schema: database design at the
logical level - describing all entities, relationships, ICs
etc…

o Instance – the actual content of the database at a particular


point in time
o Analogous to the value of the variable

o DBMS is responsible for mapping between these three


types of schemas

22
--- Example of a Database Schema Diagram

23
-- Database State

• A Database state or instance is the data in


the database at a particular moment of
time.
• Every update operation changes the
database from one state to another.
• The Schema sometimes is called the
intension, and the database state an
extension of the schema.

24
--- Example of a Database State

25
Database Languages
• Data Definition Language (DDL)
o Allows the DBA or users to:
• describe and name entities, attributes, and
relationships required for the application
• define any associated integrity and security
constraints
o Is used to define a schema or to modify an existing
one …
o It can not be used to manipulate data
o The result of compilation of DDL statements is a set
of tables stored in special files – System Catalog/
Data Dictionary
26
Database Languages
• Data Manipulation Language (DML)
o Provides basic data manipulation operations of data
held in the database (insertion, modification,
deletion and retrieval of data…)
o Part of DML involving data retrieval is called „Query
Language‟
• Procedural DML
o Allows user to tell system exactly how to manipulate
data (what data is required and how to retrieve,
e.g. PL/SQL)
• Non-Procedural DML
o Allows user to state what data is needed rather than
how it is to be retrieved (e.g. SQL)
27
Database Languages

• Fourth generation Languages (4GL)


• Non-procedural languages
o Query Languages
o Form Generators – to rapidly create data input and
display layouts for screen for screen forms
o Report Generators – to create reports from data
stored in the database
o Graphics Generators – to retrieve data from DB and
display graph showing trends/relationships
o Application Generators – facility for producing a
program that interfaces with the DB
• 4 GLs can improve productivity by a factor of ten…
28

You might also like