basic concepts of databases

25
Basic Concepts of Databases CST203-2 Database Management Systems Lecture 2

Upload: ion

Post on 06-Feb-2016

24 views

Category:

Documents


0 download

DESCRIPTION

Basic Concepts of Databases. CST203-2 Database Management Systems Lecture 2. One Tier Architecture. Eg : In this scenario, a workgroup database is stored in a shared location on a single machine Beneficial when we are dealing with data that is relevant to a single user. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Basic Concepts of Databases

Basic Concepts of DatabasesCST203-2 Database Management Systems

Lecture 2

Page 2: Basic Concepts of Databases

One Tier ArchitectureEg:

In this scenario, a workgroup database is stored in a shared location on a single machine

Beneficial when we are dealing with data that is relevant to a single user

Page 3: Basic Concepts of Databases

Client / Server architectureSystem functionality is distributed between

Client moduleServer module

Page 4: Basic Concepts of Databases

3 tier architectureTo ensure more security and load balancing

for a greater stability

Page 5: Basic Concepts of Databases

Data modelsA collection of concepts that can be used to describe

the structure of a database

“An integrated collection of concepts for describing data, relationships between data, and constraints on the data.

Database Solutions: A Step-by-step approach to building databases

Include a set of basic operations for specifying retrievals and updates on db

Page 6: Basic Concepts of Databases

Categories of Data ModelsHigh-level or Conceptual Data models

Low-level or physical data models

Representational or implementation data models

Relational data model Network data model Hierarchical data model

Page 7: Basic Concepts of Databases

Levels of AbstractionPhysical level describes how a record (e.g.: customer) is stored.

Logical level: describes data stored in database, and the relationships among the data.type customer = recordname : string;street : string;city : integer;end;

View level: application programs hide details of data types. Views can also hide information (e.g., salary) for security purposes.

Page 8: Basic Concepts of Databases

Data modeling using Entity Relationship model

Page 9: Basic Concepts of Databases

Database Schema

The logical structure of the database

Eg: the database consists of information about a set of customers and accounts and the relationship between them

Page 10: Basic Concepts of Databases

Database Instance

The actual content of the database at a particular point in time

Page 11: Basic Concepts of Databases

Three Schema Architecture

Page 12: Basic Concepts of Databases

The external schemaDefines one view of data as seen by a specific set of

applications or end users

The conceptual schemaDefines data from perspective of system designerIndependent of end users and data storage mechanism

The internal schemaDefines how data is organized, stored and manipulated in

the application itselfTotally dependent on particular implementation

Page 13: Basic Concepts of Databases

Data IndependenceLogical Data Independence

Physical Data Independence

Page 14: Basic Concepts of Databases

EntityRepresents a real world object or concept

Eg: an employee, a project

Page 15: Basic Concepts of Databases

AttributeRepresents some property of interest that

further describes an entityEg: employee’s name or salary

Page 16: Basic Concepts of Databases

RelationshipRepresents an association among 2 or more

entitiesEg: an employee works on a project

Page 17: Basic Concepts of Databases

Example of schema in the entity-relationship model

Page 18: Basic Concepts of Databases

A Sample Relational Database

Page 19: Basic Concepts of Databases

Data Definition Language (DDL)Specification notation for defining the database schema

E.g. create table account (

account-number char(10), balance integer)

DBMS have a DDL compiler

Data dictionary contains metadata (i.e., data about data)Database schema Data storage and definition language

language in which the storage structure and access methods used by the database system are specified

Usually an extension of the data definition language

Page 20: Basic Concepts of Databases

Data Manipulation Language (DML)

Language for accessing and manipulating the data organized by the appropriate data model

DML also known as query language

Two classes of languages Procedural – user specifies what data is required and how

to get those data Nonprocedural – user specifies what data is required

without specifying how to get those data

SQL is the most widely used query language

Page 21: Basic Concepts of Databases

SQLSQL: widely used non-procedural language

E.g. find the name of the customer with customer-id 192-83-7465select customer.customer-namefrom customerwhere customer.customer-id = ‘192-83-7465’

E.g. find the balances of all accounts held by the customer with customer-id 192-83-7465

select account.balancefrom depositor, accountwhere depositor.customer-id = ‘192-83-7465’ and depositor.account-number = account.account-number

Application programs generally access databases through one of Language extensions to allow embedded SQL Application program interface (e.g. ODBC/JDBC) which allow SQL queries to

be sent to a database

Page 22: Basic Concepts of Databases

Transaction ManagementA transaction is a collection of operations that performs

a single logical function in a database application

Transaction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures.

Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database.

Page 23: Basic Concepts of Databases

Example:Consider a possible interleaving

This is OK. But what about this ???????

T1: A=A+100, B=B-100 T2: A=1.06*A, B=1.06*B

T1: A=A+100, B=B-100 T2: A=1.06*A, B=1.06*B

Page 24: Basic Concepts of Databases

Storage ManagementStorage manager is a program module that

provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system.

The storage manager is responsible to the following tasks:

Interaction with the file manager Efficient storing, retrieving and updating of data

Page 25: Basic Concepts of Databases