Database
DATABASE SYSTEM
• Faculty of Computer Science
1
Database
•Chapter 1
Introduction
2
Database
Outline
Database
DBMS
Data Model
View of Data
3
Database
Database Systems
• What is Database?
• What is Database Management System (DBMS) ?
4
Database
What is a database?
• A database is a collection of data, contains information relevant to an
enterprise.
• A database is an organized collection of data.
• A database is a collection of information that is organized so that it can
easily be accessed, managed, and updated.
5
Database
What is a DBMS?
• Database management system (DBMS) is a special software application
that interacts with the user, other applications, and the database itself to
capture and analyze data.
• E.g: Some popular DBMS
6
Database
DBMS purpose
• To store data properly
• To provide simultaneous access to the data for many users
• To delimit the access to the data for different users
• To prevent data from loss
• To provide a way to store and retrieve database information that is both
convenient and efficient.
7
Database
Database systems
• Database systems are used to manage collections of data that are:
• Highly valuable
• Relatively large
• Accessed by multiple users and applications, often at the same time.
• A modern database system is a complex software system whose
task is to manage a large, complex collection of data.
• Databases touch all aspects of our lives
8
Database
Database Applications Examples
• Enterprise Information
• Sales: customers, products, purchases
• Accounting: payments, receipts, assets
• Human Resources: Information about employees, salaries, payroll taxes.
• Manufacturing: management of production, inventory, orders, supply
chain.
• Banking and finance
• customer information, accounts, loans, and banking transactions.
• Credit card transactions
• Finance: sales and purchases of financial instruments (e.g., stocks and bonds; storing
real-time market data
• Universities: registration, grades
9
Database
Database Applications Examples
• Airlines: reservations, schedules
• Telecommunication: records of calls, texts, and data usage, generating
monthly bills, maintaining balances on prepaid calling cards
• Web-based services
• Online retailers: order tracking, customized recommendations
• Online advertisements
• Document databases
• Navigation systems: For maintaining the locations of varies places of
interest along with the exact routes of roads, train systems, buses, etc.
10
Database
Purpose of Database Systems
In the early days, database applications were built directly on top of file systems, which
leads to:
• Data redundancy and inconsistency: data is stored in multiple file formats resulting
induplication of information in different files
• Difficulty in accessing data
• Need to write a new program to carry out each new task
• Data isolation
• Multiple files and formats
• Integrity problems
• Integrity constraints (e.g., account balance > 0) become “buried” in program code
rather than being stated explicitly
• Hard to add new constraints or change existing ones
11
Database
Purpose of Database Systems (Cont.)
• Atomicity of updates
• Failures may leave database in an inconsistent state with partial updates carried out
• Example: Transfer of funds from one account to another should either complete or not
happen at all
• Concurrent access by multiple users
• Concurrent access needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
• Ex: Two people reading a balance (say 100) and updating it by withdrawing money (say 50 each)
at the same time
• Security problems
• Hard to provide user access to some, but not all, data
Database systems offer solutions to all
the above problems
12
Database
Example: University Database
• Data consists of information about:
• Students
• Instructors
• Classes
• Application program examples:
• Add new students, instructors, and courses
• Register students for courses, and generate class rosters
• Assign grades to students, compute grade point averages (GPA) and generate
transcripts
13
Database
Data Models
• Underlying the structure of a database is the data model: a collection of
conceptual tools for describing
• Data
• Data relationships
• Data semantics
• Consistency constraints
14
Database
Data Models
• There are a number of different data models:
• Relational model
• Entity-Relationship data model (mainly for database design)
• Object-based data models (Object-oriented and Object-relational)
• Semi-structured data model (XML)
• Other older models:
• Network model
• Hierarchical model
15
Database
Relational Model
• Example of tabular data in the relational model:
Columns
Rows
✓ The relational model uses a collection of tables
to represent both data and the relationships
among those data.
✓ Each table has multiple columns, and each
column has a unique name.
✓ Tables are also known as relations.
16
Database
View of Data
• Levels of data abstraction, to simplify users’ interactions with the system:
• The three levels of data abstraction:
17
Database
Data Abstraction
• View level: The highest level of abstraction describes only part of the entire
database. The system may provide many views for the same database. Views can
also hide information (such as an employee’s salary) for security purposes.
• Logical level: describes what data are stored in the database, and what
relationships exist among those data. E.g: Describe the type of a record instructor
with 4 fields:
type instructor = record
ID : char(5);
name : char(20);
dept_name : char(20);
salary : numeric(8,2);
end;
• Physical level: the lowest level of abstraction describes how the data are actually
stored.
18
Database
RDBMS
• RDBMS which stands for relational database management system, is a
program that lets users create, update, and administer a relational
database.
• Are used in most commercial projects
19
Database
RDBMS installation (Lab 7)
• Install RDBMS Server
• Microsoft SQL Server 2014 Express/2019
• Install client application for querying data
• Microsoft SQL Server Management studio
20
Database