Classic File Processing vs. DBMS Overview
Classic File Processing vs. DBMS Overview
Storing in
Access
SS
Scattered Direct
Contiguous Sequential
(index)
Variable
Fixed size Table Tree
size
❑ The classic approach involves creating an application program for a specific type of information:
▪ Patient billing..
Overview of the Classic File Processing Approach: Disadvantages
A) Organization, Storage, and Ease of Use
Use case
Problems
• Time loss
• Some information is often stored in multiple locations (e.g., Patient List and Doctor List in the Patient Appointment Management System).
• Development of applications and programs for each type of processing system and each operation.
Problems
• It cannot quickly respond to information requests from multiple files, with high costs for modifications (due to multiple systems).
• It is highly challenging to write a general program for accessing all the information.
Overview of the Classic File Processing Approach: Disadvantages
B) Programming and development
Step Description
Resource Identification The user or application identifies the resources (files) to be accessed (creates if files don't exist).
File Opening Files are opened using operating system commands or function calls.
Access Control Authorization checks are performed to determine if the user has the required permissions.
File Operations Reading, writing, deleting, etc., based on the needs of the user or application.
Error Management Handling potential errors throughout the file access process.
Resource Release Releasing all system resources when file access is no longer needed.
Concurrent processing, which is used to modify a given value from multiple tasks (functions) in real-time, can generate
errors.
Possibles scenarios :
T1 T2
IF Task 1 before Task 2 : 40 000.00 DA → 70 000.00DA → 20 000.00 DA
T2 T1
IF Task 2 before Task 1 : 40 000.00 DA → - 10 000.00DA → 20 000.00 DA
❑ Data Integrity: Ensuring that the data is accurate and adheres to defined constraints.
▪ Example 03: Individuals under 17 should always be admitted to the pediatric department.
Disadvantage Description
Repeated storage of the same information in multiple locations, resulting in wasted space and
Data Redundancy
potential coherence problems.
Data Inconsistency Difficulty in maintaining data consistency due to redundancy and manual file management.
Difficulty in Updating and Maintenance Structural modifications often require manual updates in multiple locations, which can be tedious.
Access Difficulty Sequential data access makes search and filtering operations inefficient and difficult to implement.
Offers limited security dependent on the operating system and file permissions, less sophisticated
Limited Security
than database management system access controls.
Complexity in sharing data between different applications, without integrated mechanisms to ensure
Difficulty in Data Sharing
the consistency of shared data.
Degraded Performance Performance can degrade with an increase in data volume due to sequential search and redundancy.
Lack of sophisticated mechanisms for transaction management, making it difficult to ensure data
Difficulty in Transaction Management
consistency during multiple operations.
Less flexible in terms of modifying data structure, making adaptation to changing user needs
Lack of Flexibility
challenging.
Solution : Data Base Management Systems (DBMS)
DBMS
Complexity of
Atomicity of
Protection storage and Direct access
Data banks Transactions and
assured processing hidden through data base
Data Integrity
from the user
Unique data
Database Management System(DBMS) :Definitions
A system that manages a database shared by multiple users simultaneously through a set of programs that:
Relational MySQL, PostgreSQL, Oracle Database, Microsoft SQL Server, SQLite, IBM Db2, MariaDB
Cloud-Based Amazon Aurora, Microsoft Azure SQL Database, Google Cloud Spanner
Files between the classic approach and DBMS
Separation of Data
and Programs
File Database
(The data in the database is described
(The data in the files is described outside the programs, within the database
within the programs) itself)
(File 1)
File description
(1)
Description
Unique Used by
(File 2) Permanent
Programmes Programmes
Database Management System(DBMS) : Objectives and Advantages
Example: Who are the patients with a status = 0 (Waiting for diagnosis)? → Using a data manipulation language
❑ A DBMS must be available for every usage request, ensuring meticulous management of system failures.
E) Access Performance
Direct Access: Indexing (hashing, B-tree, and m-ary trees, etc.) (Most commonly used)
Real world
04-Physical conception
Database Modeling Process
01- Requirements Gathering and Analysis: Requirements gathering and analysis in database modeling involve
understanding business needs, identifying stakeholders, and designing an appropriate data structure.
Business Requirements: Define what the organization expects from the information system to achieve its operational goals.
Problem Analysis:
02- Conceptual Design: Creation of the conceptual schema based on the Entity-Relationship (ER) model.
❑ Relational.
❑ Network.
❑ Hierarchical.
The choice of the DBMS determines the internal (physical) structure of the database.
Transformation of the conceptual schema from the high-level data model (Entity-Relationship) to the implementation data model (Relational,
Network, or Hierarchical).
Logical scheme
Conceptual level
(Data dictionary)
Physical scheme
(Data structure) Internal level
Data Base Management Systems (DBMS) : External level
This is the level with which end users interact. External views are created at this level to represent the specific parts of the data that a user or an
application needs
Example
The employees of the patient department need access to information about patients, such as medical records, appointments, etc.
Objective: Provide a specific view to enable the patient department staff to manage appointments, review patients' medical history, and
handle payment statuses.
Doctors and nurses need access to medical records, test results, prescriptions, doctors' consultation schedules, etc.
Objective: Provide a specific view to enable medical staff to monitor treatments, prescribe medications, and access medical examination
results.
Data Base Management Systems (DBMS) : Conceptual level
❑ Define the overall structure of the database, including entities, relationships, integrity constraints, and business rules.
❑ Conceptual schemas are created at this level to describe the structure of the database
Relationships: A patient can have multiple appointments, a doctor can have multiple patients, etc. The relationship between the
entities is established by foreign keys and/or relationship entities.
Integrity Constraints: An appointment cannot exist without an associated patient, etc.
Data Base Management Systems (DBMS) : Conceptual level
row
ID_Patient Name_Surname Department Age Gender Status
P001 Mohamed Benabdellah Cardiologie 50 Homme 0
P002 Fatima Zahra Benslimane Pédiatrie 8 Femme 2 n-uplet
P003 Ahmed Bouzid Ophtalmologie 70 Homme 0
P004 Sarah Benouari Chirurgie 35 Femme 1 tuple
Clé Rows:
primaire
(unique) • Correspond to a record/item (in a file)
• Identified by a key
Data Base Management Systems (DBMS) : Conceptual level
To find the amount to be paid by a patient "Fatima Zahra Benslimane," the system first searches for the primary key (ID_Patient) of Fatima in
the Patient table. Then, it uses the foreign key ID_Patient from the Invoice table to find the corresponding row.
❑ Tables: The internal schema details the structure of the database tables.
❑ Relations: It specifies how the relationships between tables are implemented at the physical level. For example, the link between the "Invoice"
table and the "Patients" table is made using the foreign key "ID_patient“.
❑ Data Types: The internal schema defines the data types associated with each column (integer, string, date, etc.).
❑ Integrity Constraints: It outlines the integrity constraints at the physical level, such as primary and foreign keys, to ensure data consistency.
Index on the Patient ID Number: To speed up searches based on the patient's identification number, an index can be created on this
column. This reduces the time required to find specific records associated with a patient.
Other Indexes: Depending on the needs, other indexes can be created on columns frequently used in queries, such as appointment
• Optimization: Includes details on how the database is optimized for performance, such as table partitioning, the
use of caches, etc.
Table Partitioning: If the database becomes large, table partitioning can be used to physically divide the data into
manageable subsets, thereby improving query performance.
Use of Caches: Caching frequently used query results can reduce access time to this data, thus enhancing overall
performance.
Query Optimization: Techniques such as analyzing query execution plans can be used to optimize query performance.
Transaction Management: Optimization may also include transaction management strategies to ensure data consistency
while maintaining good performance.
Database Management Systems (DBMS): Database modeling
Data modeling allows for the correct description of a database's architecture, including the data, their
DB model
Entity/Relation
model
• Relational
Data base • Hierarchical
structure • Network
Database Management Systems (DBMS): Database modeling
Relational database
LDAP (Lightweight Directory IMS (Information Management
Implementation Example management systems (MySQL, Oracle, MySQL, PostgreSQL
Access Protocol) System)
PostgreSQL, etc.)
Database Management Systems (DBMS): Entity/Relationship model
ER (Entity-Relationship) : A formalism adopted by ISO to describe the conceptual aspect of data using entities and
relationships.
ER
Entity
Representation of a material object (Patient, Doctor, Organizers) or an immaterial object (Consultation, Invoice).
Entity_Name
Liste of properties
Database Management Systems (DBMS): Entity/Relationship model
PROPRIETIES
• The properties of an entity are also called attributes or characteristics of that entity.
Patient
• ID_Patient
• Name_Surname
• Age
• Gender
• Status
Database Management Systems (DBMS): Entity/Relationship model
THE IDENTIFIER
The identifier of an entity is chosen by the analyst in such a way that two occurrences of this entity cannot have the same identifier.
For example, the identifier of the patient will be the identifier of the Patient entity.
Patient
• ID_Patient
• Name_Surname
• Age
• Gender
• Status
Database Management Systems (DBMS): Entity/Relationship model
ASSOCIATIONS
Patient Doctor
• ID_Patient • ID_Doctor
• Name_Surname Consultation • Name_Surname
• Age • Specialty
• Gender Prescription • Age
• Status • Rank
Database Management Systems (DBMS): Entity/Relationship model
CARDINALITIES
The cardinality of an association for an entity consists of a minimum bound and a maximum bound:
Minimum: The minimum number of times an occurrence of the entity participates in the occurrences of the association, typically 0 or 1.
Maximum: The maximum number of times an occurrence of the entity participates in the occurrences of the association, typically 1 or n.
Doctor Patient
❑ A doctor can consult a maximum of n
• ID_Doctor • ID_Patient
Consult patients, whereas a patient can be
• Name_Surname 1,n 1,m • Name_Surname
consulted by a maximum of m doctors.
• Specialty • Age
Prescription
• Age • Gender
• Rank • Status
By noting only the maximum cardinalities, three types of links can be distinguished:
❑ Minimum cardinalities are necessary to express
integrity constraints. Functional link (1:n): One instance of A can only be associated with a single instance of B.
❑ Maximum cardinalities are necessary to design Hierarchical link (n:1): One instance of A can be associated with multiple instances of B.
the database schema
Network link (n:m): One instance of A can be associated with multiple instances of B, and vice versa
Database Management Systems (DBMS): Entity/Relationship model
Doctor Patient
• ID_Doctor • ID_Patient
1,n Consult 1,m
• Name_Surname • Name_Surname
• Specialty • Age
• Age
Prescription • Gender
n
• Rank • Status
1 1
Pay
Associate
1
m Invoice
Ddepartment • ID_Invoice
• ID_Department • Amount_to_Pay
n Attribute • Statu_F
• Name_Dep
• Capacity
Database Management Systems (DBMS): RELATIONAL SCHEMA
❑ The relational schema is the set of RELATIONS that describes the entity/association model.
❑ The relations represent entities (such as patients, doctors) or the associations between these entities (e.g., consultation, payment)
Database Management Systems (DBMS): RELATIONAL SCHEMA
Transition from an E-A conceptual schema to a relational schema
❑ A M:N association is represented by the relation: association_name (list of identifiers of the participating entities, list of the
association's attributes)
Doctor Patient
• ID_Doctor • ID_Patient
• Name_Surname 1,n Consulter 1,m • Name_Surname
• Specialty Prescription • Age
• Age • Gender
• Rank • Status
Database Management Systems (DBMS): RELATIONAL SCHEMA
Doctor(ID_Doctor,Name_Surname,Speciality,Age,Rank) Patient(ID_Patient,Name_Surname,Age,gender,Status)
ID_Patient Name_Surname Age Sexe Statut
ID_Médecin Nom_Prenom Spécialité Age Grade
Patient
• ID_Patient Ddepartment
• Name_Surname 1 • ID_Department
• Age Attribute • Name_Dep
• Gender n • Capacity
• Status
The same conversion as (1:N) is followed, or the 1:1 cardinality is represented in the relational model by a single table
Patient
• ID_Patient
Invoice •
1 Name_Surname
• ID_Invoice • Age
Payer
• Amount_to_Pay • Gender
• Statu_F 1 • Status
Unique key
A primary key is a unique key, but the reverse is not necessarily true.
Database Management Systems (DBMS): RELATIONAL SCHEMA (Advantages)
FEATURE DESCRIPTION
Relational algebra
RELATIONAL OPERATIONS
Assertion languages
Access optimization
PHYSICAL INDEPENDENCE
Operators:
❑ Search.
❑ Generate reports.
Administrator:
Systems Analyst:
Application Programmers:
❑ Implements the specifications into a program using a language programing language (JAVA, C++, etc).
Database Management Systems (DBMS): Operation
Invisibles Task
MM SS
Workflow of DBMS