You are on page 1of 24

Introduction to Databases

CS1703 Data and Information

Dr Alan Serrano
Department of Computer Science, Brunel University
London

1
Outline of lecture
Introduction to the database approach
Schemas and user views
Functions of a DBMS
Advantages and disadvantages of DBMSs
The relational model
Data models
Relational data structure
Relational integrity

2
What is a Database (DB)?
“A shared collection of logically related data (along
with a description of this data), designed to meet the
information needs of an organisation”
A single repository of data that can be used
simultaneously by many departments and users
Data is integrated and duplication minimised
DB is a self-describing collection of integrated records
Metadata or ‘data about data’ is stored in the system
catalogue or data dictionary

3
Databases
What databases does Brunel rely on?

4
Components of a database
system

5
Components of a database
system
Hardware – computer systems that store and run the
DB system
Software – DBMS, applications etc.
Data – operational data and metadata
Procedures and policies
People – business analysts, DB designers and
programmers, end-users

6
Database Management System
(DBMS)
“Software that enables users to define, create, and
maintain the database, and provides controlled access
to this database”
Provides a general inquiry facility to the data by means
of a query language (e.g SQL)

7
Database applications
“A computer program that interacts with the database
by issuing an appropriate request (i.e. One or more
SQL statements) to the DBMS”

Applications handle
Data entry
Data maintenance
Generation of reports

8
Views
A view is defined as “a virtual table that does not
necessarily exist in the database but is generated by the
DBMS from the underlying base tables whenever it is
accessed”
Key benefits are:
Usability is improved
Provide a level of security
Provide a mechanism to customise the appearance of
the database
Can present a consistent, unchanging picture of the
structure
9
DBMS architectures
Early DB systems employed simple
two-tier client-server architecture
Several problems
Replaced by three-tier architecture
as applications became more
complex (and due to advent of the
WWW)
Many advantages over client-server:
Lower hardware requirements
Simplified maintenance
Modularity
Scalability
Maps naturally to web environment

10
Functions of a DBMS
Data storage, retrieval, and update
A user-accessible system
catalogue
Transaction support
Concurrency control and recovery
services
Authorisation services
Support for data communication /
networking
Utility services
11
Functions of a DBMS
Integrity services
Database integrity refers to the quality of stored data;
its correctness and consistency
Integrity is defined by constraints

Services to promote data independence


Physical changes (e.g. changing file structures) can
normally be achieved without affecting user views (and
applications)
Logical data independence is harder to achieve,
particularly when tables or columns are removed
Some systems simply prohibit such structural changes

12
Pros and cons of the database
approach
Pros
Control of data redundancy
Data consistency
Sharing of data
Improved data integrity and data independence
Cons
Complexity
Costs – system and conversion
Performance
Centralisation  high impact of failure

13
Data models
Models are representations of real world objects, processes
and events, and their associations
A data model attempts to represent the data requirements
of the organisation (or some part)
It should provide integrated collection of concepts for
describing data, relationships between data, and
constraints on the data used by an organization
Three components:
 Structural part – set of rules that define the design of DB
 Manipulative part – defining types of operations
(transactions) allowed on the data
 Set of integrity rules that ensure the data remains accurate

14
The relational model
Been around since the early 1980’s but still dominant
model
Objectives of relational model:
To allow high degree of data independence – apps must
not be affected by changes to internal data representation
To control problems of semantics, consistency and
redundancy (e.g. through normalised relations)
To enable extension of set-oriented data manipulation
language (e.g. SQL)
Well known relational DB systems?

15
Relational data structure
Relational
Database

16
Domain – the range of allowable values for
one or more attributes

17
Properties of relational tables
Table names are distinct
Each cell of table contains exactly one value
Each column has a distinct name
Values of a column are all from the same domain
Each record is distinct; there are no duplicate records
Order of columns has no significance
Order of records has no significance

18
Relational Keys
Minimal set of columns that identify a row as unique

Types of key
Superkey
Candidate key
Composite key
Primary key
Alternate key

Representing relationships
Foreign key

19
Keys example
How many candidate key(s) in Staff table below?
What is the role of the foreign key in DistributionCenter?

20
Relational Integrity
Integrity constraints ensure that the data is accurate
and within pre-defined constraints

Two general rules:


Entity integrity
Referential integrity
Also specific rules:
Domain constraints
Multiplicity constraints

21
A null represents value for

Relational Integrity
a column that is currently
unknown or not applicable
for record
Entity Integrity
 Ina base table, no column of a primary key can be
null
 Why is this?

Referential Integrity
 Ifa foreign key exists in a table, either foreign key
value must match a candidate key value of some
record in its home (parent) table or foreign key value
must be wholly null
 i.e. cannot refer to a non-existent record

22
Future database topics
Next week SQL
Later in Term 2:
Database development lifecycle
Requirements analysis
Entity relationship modelling
Normalisation
DB design process (conceptual and logical stages)

23
Review this lecture
Connolly, T., Begg, C. & Holowczak, R (2008)
Business Database Systems
 Chapters 1 and 2

 Note new textbook:


 HF5548.2.C623 2008
 E-book version if no copies left

24

You might also like