0% found this document useful (0 votes)
186 views

Lecture 8 - Database Schema

This document discusses database schemas and data models. It covers the ANSI/Spark three-level data model including the physical, logical, and view levels. The physical level describes how data is stored. The logical level describes the conceptual structure and relationships of data. The view level describes each user's customized view. A database schema defines the overall design and includes descriptions of the database structure, data types, and constraints. The database state refers to the actual stored data at a point in time, while the schema changes infrequently.

Uploaded by

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

Lecture 8 - Database Schema

This document discusses database schemas and data models. It covers the ANSI/Spark three-level data model including the physical, logical, and view levels. The physical level describes how data is stored. The logical level describes the conceptual structure and relationships of data. The view level describes each user's customized view. A database schema defines the overall design and includes descriptions of the database structure, data types, and constraints. The database state refers to the actual stored data at a point in time, while the schema changes infrequently.

Uploaded by

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

ICT 321

DATABASE SCHEMA

Agenda
Data model
ANSI/Spark Data Model
Database schema and instances

Data Models
Data Model:
A set of concepts to describe the structure of
a database, the operations for manipulating
these structures, and certain constraints that
the database should obey.

Data Model Structure and


Constraints:
Constructs are used to define the database
structure
Constructs typically include elements (and
their data types) as well as groups of
elements (e.g. entity, record, table), and
relationships among such groups
Constraints specify some restrictions on valid

Data Models (continued)


Data Model Operations:
These operations are used for specifying
database retrievals and updates by
referring to the constructs of the data
model.
Operations on the data model may
include basic model operations (e.g.
generic insert, delete, update) and
user-defined operations (e.g.
compute_student_average_mark,
update_inventory)
4

Categories of Data Models


Conceptual (high-level,
semantic) data models:
Provide concepts that are close to the
way many users perceive data.
(Also called entity-based or objectbased data models.)

Physical (low-level, internal)


data models:
Provide concepts that describe details of
how data is stored in the computer.
These are usually specified in an ad-hoc
manner through DBMS design and
administration manuals
5

Categories of Data Models


Implementation
(representational) data models:
Provide concepts that fall between the
above two, used by many commercial
DBMS implementations (e.g. relational
data models used in many commercial
systems).

ANSI/Spark Data Model


Developed by American National Standard
Institute/ Standards Planning and
Requirements Committee)
Also known as ANSI-SPARC Three-Level
Architecture
This model provides some level of data
abstraction and data independence
Data abstraction generally refers to the
suppression of details of data organization
and storage, and the highlighting of the
essential features for an improved
understanding of data
7

ANSI/Spark Data Model


The different levels(schema) of data
abstraction are:
1. Physical level or internal level
2. Logical level or conceptual level
3. View level or external level

ANSI/Spark Data Model

ANSI/Spark three level architecture diagram


9

ANSI/Spark Data Model


Data independence means the
internal structure of database should
be unaffected by changes to physical
aspects of storage I.e. the DBA can
change the database storage
structures without affecting the users
view.
The data independence can be both
logical and physical
10

ANSI/Spark Data Model


Logical Data Independence:
The capacity to change the conceptual
schema without having to change the
external schemas and their associated
application programs.

Physical Data Independence:


The capacity to change the internal
schema without having to change the
conceptual schema.
For example, the internal schema may be
changed when certain file structures are
reorganized or new indexes are created to
improve database performance
11

ANSI/Spark Data Model


When a schema at a lower level is
changed, only the mappings between
this schema and higher-level schemas
need to be changed in a DBMS that
fully supports data independence.
The higher-level schemas themselves
are unchanged.
Hence, the application programs need not
be changed since they refer to the
external schemas.
12

ANSI/Spark Data Model


Mappings among schema levels are
needed to transform requests and
data.
Programs refer to an external schema,
and are mapped by the DBMS to the
internal schema for execution.
Data extracted from the internal DBMS
level is reformatted to match the users
external view (e.g. formatting the results
of an SQL query for display in a web
page)
13

ANSI/Spark Data Model


The objective of this architecture is to
separate each users view of the
database from the way the database is
physically represented. There are
several reasons why this separation is
desirable:
1. Each user should be able to access the
same data, but have a different
customized view of the data.
2. Users should not have to deal directly
with physical database storage details
14

ANSI/Spark Data Model


3. The DBA should be able to change the
database storage structures without
affecting the users views.
4. The internal structure of the database
should be unaffected by changes to the
physical aspects of storage, such as
the changeover to a new storage
device.
5. The DBA should be able to change the
conceptual structure of the database
without affecting all users.
15

View level or external level


The users view of the database.
This level describes that part of the
database that is relevant to each
user.
Each external schema describes the
part of the database that a particular
user group is interested in and hides
the rest of the database from that
user group.
16

View level or external level- example

Auto insurance database: external


schema.

17

Logical level or conceptual level


The community view of the database.
This level describes what data is
stored in the database and the
relationships among the data.
This level contains the logical
structure of the entire database as
seen by the DBA.
The conceptual model represents a
global view of the entire database as
viewed by the entire organization.
18

Logical level or conceptual level


That is, the conceptual model
integrates all external views (entities,
relationships, constraints, and
processes) into a single global view of
the data in the enterprise.
The conceptual level represents:
all entities, their attributes, and their
relationships;
the constraints on the data;
semantic information about the data;
security and integrity information.
19

Logical level or conceptual level

Auto insurance database: conceptual schema

20

Physical level or internal level


The physical representation of the
database on the computer. This level
describes how the data is stored in the
database.
The internal level is concerned with such
things as:
storage space allocation for data and indexes;
record descriptions for storage (with stored
sizes for data items);
record placement;
data compression and data encryption
techniques.
21

Physical level or internal level


Below this level there is where data
are managed by the operating
system under the direction of the
DBMS
The internal schema uses a physical
data model and describes the
complete details of data storage and
access paths for the database.

22

Physical level or internal level

Auto insurance database: internal schema.


23

Database Schemas
The description of a database.
The overall design of the database is
called the database schema
It is a collection of named objects
which provide a logical classification
of objects in the database.
It Includes descriptions of the
database structure, data types, and
the constraints on the database.
24

Database Schemas
A schema is also an object in the
database. It is explicitly created using
the CREATE SCHEMA statement with
the current user recorded as the
schema owner.
Schema Diagram:
An illustrative display of (most aspects
of) a database schema.

Schema Construct:
A component of the schema or an object
within the schema, e.g., STUDENT,
COURSE.
25

Database Schemas
Schema classification

26

Database Schemas - example

27

Database Schema - example

28

Database Instances
Database State:
The actual data stored in a database at
a particular moment in time. This
includes the collection of all the data in
the database.
Also called database instance (or
occurrence or snapshot).

The term instance is also applied to


individual database components, e.g.
record instance, table instance,
entity instance
29

database state - example

30

Database Schema vs. Database


State
Database State:
Refers to the content of a database at a
moment in time.

Initial Database State:


Refers to the database state when it is
initially loaded into the system.

Valid State:
A state that satisfies the structure and
constraints of the database.
31

Database Schema vs. Database State

Distinction
The database schema changes very
infrequently.
The database state changes every
time the database is updated.

32

You might also like