Introduction To Database Systems
Introduction To Database Systems
Systems
Database Systems Lecture 1
Khalid Abbasi
In this Lecture
• Course Information
• Databases and Database Systems
• Some History
• The Relational Model
Course Information
•Contact details •Assessment
• Khalid Abbasi • 25% Coursework
• Some lab-marked
exercises
•Lectures • A written exercise
with a database
• Monday at 9:00 am design
• Tuesday at 9:00 am • 75% Examination
• Labs Tuesday 9:00
am - 10:30am
starting 13 February
Textbook
• Recommended •Other textbooks:
textbooks: • There are lots of
• ‘Database Systems: A database texts
practical approach to • Most of them would
design, implementation be fine also
and management’ by
Connolly and Begg •For example:
• ‘Database Systems’ by
CJ Date
Course Overview
• Several main topics • Practical sessions
• Database systems • Will start on 2 Oct
• Data models 2018
• Database design
• SQL
• Transactions
• Concurrency
• Administration
Why Study Databases?
• Databases are useful • Databases in CS
• Many computing • Databases are a ‘core
applications deal with topic’ in computer
large amounts of science
information • Basic concepts and
• Database systems skills with database
give a set of tools for systems are part of
storing, searching and the skill set you will
managing this be assumed to have
information as a CS graduate
What is a Database?
• “A set of information held in a
computer”
Oxford English Dictionary
• “One or more large structured sets of
persistent data, usually associated with
software to update and query the data”
Free On-Line Dictionary of Computing
• “A collection of data arranged for ease
and speed of search and retrieval”
Dictionary.com
Databases
• Web indexes • Train timetables
• Library catalogues • Airline bookings
• Medical records • Credit card details
• Bank accounts • Student records
• Stock control • Customer histories
• Personnel systems • Stock market prices
• Product catalogues • Discussion boards
• Telephone directories • and so on…
Database Systems
• A database system • Database systems
consists of allow users to
• Data (the database) • Store
• Software • Update
• Hardware • Retrieve
• Users • Organise
• We focus mainly on • Protect
the software their data.
Database Users
• End users • Database
• Use the database Administrator (DBA)
system to achieve • Designs & manages
some goal the database system
• Application • Database systems
developers programmer
• Write software to • Writes the database
allow end users to software itself
interface with the
database system
Database Management
Systems
• A database is a • Examples:
collection of • Oracle
information • DB2 (IBM)
• A database • MS SQL Server
management system • MS Access
(DBMS) is the • Ingres
software that • PostgreSQL
controls the • MySQL
information
What the DBMS does
• Provides users with • DBMS provides
• Data definition • Persistence (not likely to be
language (DDL) e.g modified)
Create, Alter, Rename • Concurrency (multiple
etc. processes to access/change
• Data manipulation shared data)
language (DML) e.g • Integrity (accuracy)
Insert, Update, • Security
Delete, Select.
• Data independence (change
• Data control language physical storage without
(DCL) e.g Grant, affecting conceptual or
revoke. external view)
• Often these are all • Data Dictionary
the same language • Describes the database itself
Data Dictionary - Metadata
• The dictionary or • The dictionary holds
catalog stores • Descriptions of
information about database objects
the database itself (tables, users, rules,
views, indexes,…)
• This is data about • Information about
data or ‘metadata’ who is using which
• Almost every aspect data (locks)
of the DBMS uses • Schemas (defines the
tables, the fields in
the dictionary
each table, and the
relationships between
fields and tables)
File Based Systems
• File based systems • Problems:
• Data is stored in files • No standards
• Each file has a specific • Data duplication
format • Data dependence
• Programs that use • No way to generate
these files depend on ad hoc queries
knowledge about that • No provision for
format security, recovery,
concurrency, etc.
Relational Systems
• Problems with early • Then, in 1970,
databases E. F. Codd wrote “A
• Navigating the Relational Model of
records requires Data for Large
complex programs Shared Databanks”
• There is minimal data and introduced the
independence
relational model
• No theoretical
foundations
Relational Systems
• Information is stored • The relational model
as tuples or records covers 3 areas:
in relations or tables • Data structure
• There is a sound • Data integrity
mathematical theory • Data manipulation
of relations • More details in the
• Most modern DBMS next lecture…
are based on the
relational model
ANSI/SPARC Architecture
• ANSI - American • A three-level
National Standards architecture
Institute • Internal level: For
• SPARC - Standards systems designers
Planning and • Conceptual level: For
database designers
Requirements and administrators
Committee • External level: For
• 1975 - proposed a database users
framework for DBs
Internal Level
• Deals with physical • Internal Schema
storage of data RECORD EMP
LENGTH=44
• Structure of records
HEADER: BYTE(5)
on disk - files, pages,
OFFSET=0
blocks
NAME: BYTE(25)
• Indexes and ordering OFFSET=5
of records SALARY: FULLWORD
• Used by database OFFSET=30
system programmers DEPT: BYTE(10)
OFFSET=34
Conceptual Level
• Deals with the • Conceptual Schema
organisation of the CREATE TABLE
data as a whole Employee (
• Abstractions are used Name
to remove VARCHAR(25),
unnecessary details of Salary REAL,
the internal level
Dept_Name
• Used by DBAs and
VARCHAR(10))
application
programmers
External Level
• Provides a view of • External Schemas
the database tailored Payroll:
to a user String Name
• Parts of the data may double Salary
be hidden
• Data is presented in a Personnel:
useful form char *Name
• Used by end users char *Department
and application
programmers
Mappings
• Mappings translate • Physical data
information from one independence
level to the next • Changes to internal
• External/Conceptual level shouldn’t affect
• Conceptual/Internal conceptual level
External External
External Schemas
View 1 View 2
External/Conceptual Mappings
Conceptual DBA
Conceptual Schema View
Conceptual/Internal Mapping