Database
Database
Database Fundamentals
Content
• Introduction to database
• File based systems
• Database management systems
• Centralized Database Systems
• Client-Server Database Systems
• Distributed Database Systems
Session Objectives and Learning Outcomes
• Know common database terminology
• Understand requirements and uses of data
• Know the differences between databases and flat files
• Realize the importance and need for databases in problem-solving
• Understand the different types of databases and their differences
Data: A Resource
• The Success of an organization depends
on efficient use of its resources:
• Buildings, factories, equipment
• Technical know-how
• Human resources
• Data
• Data: An important organizational
resource
Data
• Data are basic values or facts
• Every task a computer carries out works with data in some way.
Without data, a computer would be pretty useless
• It is, therefore, important to understand how to represent and
organize data.
Analog vs Digital Data
• Analog data are continuous
• Nature is analog
• Digital data are discrete and broken
up into a limited number of
elements
• Computers are digital
• All data is stored in binary digits, and
there is a limit to how much data we
can represent.
Types of Data
• Computer systems work with different types of digital data.
• In the early days of computing, data consisted primarily of text and
numbers
• Nowadays, there are lots of different multimedia data types, such as
audio, images, graphics and video
• Ultimately, all data types are stored as binary digits
• For each data type, there are very specific techniques to convert
between the binary language of computers and how we interpret
data using our senses, such as sight and sound.
Databases
• A database is an organized collection of data
• A database provides a structure to organize the data.
• One of the most common data structures is a database table
https://www.youtube.com/watch?v=wR0jg0eQsZA
Data Structure
• Why?
• Large volume in a small space
• Ease of sharing
• Ease of use
• Data analysis
• How?
• File-based system versus databases
File Based Systems
• File based systems
• Data is stored in files
• Each file has a specific format
• Programs that uses these files depend on knowledge
about that format
Problems with file based Systems
• Uncontrolled data redundancy
• Data inconsistency
• Poor data sharing
• Data duplication
• Difficult to keep up with changes
• No provision for security, recovery, concurrency
etc.
• Low productivity
• High maintenance cost
What is a Database System?
25
Group Discussion
• Library catalogues
• Medical records
• Bank accounts
• Airline bookings
• Train timetables
• Stock market prices
27
Example: Banking System
Data = information on accounts,
customers, balances, current interest
rates, transaction histories, etc
Massive
Persistent
Multi-user
28
Example (2 of 4)
29
Example (3 of 4)
30
Example (4 of 4)
Safe
Convenient
Efficient
31
Database Users
• End users
• Use the database system to achieve some goal
• Application developers
• Write software to allow end users to interface with the database system
Examples of DBMS
• DB2 (IBM)
• SQL Server, Access (Microsoft),
• Oracle
33
DBMS
• A Specialized piece of software that sits between the data and
its users.
• Buy, install, set up for particular application
• Available for PC’s, workstations, mainframes, supercomputers
• Is expected to:
• Allow users to create new databases (schema)
• Give users the ability to query/modify the data
• Support the storage of very large amounts of data
• Control access to data from many users at once
DBMS
Users / Programmers
DATABASE
• Powerful tool for Application Programs / Queries
providing efficient, SYSTEM
convenient, and safe DBMS
multi-user storage of SOFTWARE Processing Queries / Programs
and access to
massive amounts of Accessing Stored Data
persistent data
Stored Database
Stored
Definition
Database
(Meta-Data)
Database Systems
• A database system consists of
• Data (the database)
• Software
• Hardware
• Users
• Database systems allow users to
• Store
• Update
• Retrieve
• Organise
• Protect
their data.
An Example
The Internet Movie Database
http://www.imdb.com
• Entities:
Actors (800k), Movies (400k), Directors, …
• Relationships:
who played where, who directed what, …
37
Functionality
1. Create/store large datasets
2. Search/query/update
3. Change the structure
4. Concurrent access to many user
5. Recover from crashes
38
1. Create/store Large Datasets
• Files Yes, but…
• DBMS Yes
39
2. Search/Query/Update
• Simple query:
• In what year was ‘Rain man’ produced ?
• Multi-table query:
• Find all movies by ‘Coppola’
• Complex query:
• For each actor, count her/his movies
• Updating
• Insert a new movie; add an actor to a movie; etc
40
2. Search/Query/Update
• Files Simple queries
• DBMS All
Updates: generally OK
41
3. Change the Structure
Add Address to each Actor
• DBMS Yes
42
How to Use a DBMS
• Requirements modeling (conceptual)
• Decide what entities should be part of the application and
how they are related
• Schema design and database creation
• Decide on a database schema
• Define the schema to the DBMS
• Load data into the database
• Access to data
• Use a database language
• Write database application programs
• Use database application programs
43
Database Language
• Data Definition Language (DDL). Used to define & change database
schemas.
• Storage Definition Language (SDL). Specify the physical schema.
• View Definition Language (VDL). Used to represent information to
users.
• Data Manipulation Language (DML). Used to query & update data.
44
Who Are Happy with Databases?
• DBMS implementers (???)
• End users and DBMS vendors
• DB application programmers
• E.g. smart webmasters
• Database administrator (DBA)
• Designs logical /physical schemas
• Handles security and authorization
• Data availability, crash recovery
• Database tuning as needs evolve
45
Centralized Database Systems
Database
Client/Server Database Systems
Client
Client
Database
Server
Distributed Database Systems
Database
Server
Database Database
Server Server
Summary
• Data is essential for an organization
• A Database is usually the most effective way of storing and
organizing data
• File-based Vs. database systems
• Database system properties
• Types of database systems
• DBMS used to maintain, query large datasets.
• Benefits include recovery from system crashes, concurrent
access, quick application development, data integrity, and
security.
49