AnitaAPSupramaniam
18 views
50 slides
Jun 06, 2024
Slide 1 of 50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
About This Presentation
database
Size: 2.92 MB
Language: en
Added: Jun 06, 2024
Slides: 50 pages
Slide Content
TOPIK 1 PENGENALAN KEPADA PANGKALAN DATA 1
2 TOPIc 1.0 Minggu Sub topic 1 TOPIC 1.0 : Introduction to Database Concept 1.1. Describe the database function in daily usage 1.1.1. Business application 1.1.2. Financial transaction 1.1.3. Customer information 1.2. Identify data model in database system 1.2.1. Hierarchical model 1.2.2. Relational model 1.2.3. Network model 1.2.4. Object-oriented model
3 TOPIc 1.0 Minggu Sub topic 1 TOPIC 1.0 : Introduction to Database Concept 1.3 Explain the importance of data quality in database system including: 1.3.1. Data integrity 1.3.2. Data consistency 1.3.3. Data redundancy
DATABASE 4 Database – A collection of related data stored in a manner that enables information to be retrieved as needed • Database Management System (DBMS ) – Used to create, maintain, and access databases Database engine • The part of the program that actually stores and retrieves data – Microsoft Access, OpenOffice Base, Corel Paradox, Oracle Database, etc.
Database Management System (DBMS) Collection of interrelated data Set of programs to access the data DBMS contains information about a particular enterprise DBMS provides an environment that is both convenient and efficient to use. Database Applications: Banking: all transactions Airlines: reservations, schedules Universities: registration, grades Sales: customers, products, purchases Manufacturing: production, inventory, orders, supply chain Human resources: employee records, salaries, tax deductions Databases touch all aspects of our lives
Purpose of Database System In the early days, database applications were built on top of file systems Drawbacks of using file systems to store data: Data redundancy and inconsistency Multiple file formats, duplication 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 part of program code Hard to add new constraints or change existing ones
Purpose of Database Systems (Cont.) Drawbacks of using file systems (cont.) Atomicity of updates Failures may leave database in an inconsistent state with partial updates carried out E.g. transfer of funds from one account to another should either complete or not happen at all Concurrent access by multiple users Concurrent accessed needed for performance Uncontrolled concurrent accesses can lead to inconsistencies E.g. two people reading a balance and updating it at the same time Security problems Database systems offer solutions to all the above problems
DBMS Environment Hardware Client-server architecture Software dbms , os , network, application Data Schema, subschema, table, attribute People Data administrator & database administrator Database designer: logical & physical Application programmer End-user: naive & sophisticated Procedure Start, stop, log on, log off, back up, recovery
Where is the Database usually used? 9
Business application 10
11
Financial transaction 12
13
Customer information 14
15
DATA MODEL 16
Database Systems 6e / Rob & Coronel 2- 17 The Development of Data Models
History of Database Systems First generation Hierarchical model I nformation M anagement S ystem (IMS) Network model Co nference on Da ta S y stem Languages (CODASYL) D ata B ase T ask G roup (DBTG) Limitation Complex program for simple query Minimum data independence No theoretical foundation Second generation Relational model E. R. Codd DB2, Oracle Limitation Limited data modeling Third generation Object-relational DBMS Object-oriented DBMS
Hierarchical model 19
A Hierarchical Model
2- 21 A Hierarchical Structure
2- 22 Hierarchical Structure—Characteristics Each parent can have many children Each child has only one parent Tree is defined by path that traces parent segments to child segments, beginning from the left Hierarchical path Ordered sequencing of segments tracing hierarchical structure Preorder traversal or hierarchic sequence “Left-list” path If Part D is most frequently accessed and updated, change the database structure to place Part D closer to the left side of the tree This will give a shorter traversal
A Hierarchical Structure One-to-many relationship: The data here is organised in a tree-like structure where the one-to-many relationship is between the datatypes. Also, there can be only one path from parent to any node. Example: In the above example, if we want to go to the node sneakers we only have one path to reach there i.e through men's shoes node. Parent-Child Relationship: Each child node has a parent node but a parent node can have more than one child node. Multiple parents are not allowed. Problem: If a parent node is deleted then the child node is automatically deleted. Pointers : Pointers are used to link the parent node with the child node and are used to navigate between the stored data. Example: In the above example the ' shoes ' node points to the two other nodes ' women shoes ' node and ' men's shoes ' node .
The Hierarchical Model Advantages over a file system It is very simple and fast to traverse through a tree-like structure. Conceptual simplicity – easy to understand the model layout Database security Data independence (a change in a data type will be automatically cascaded throughout the database by the DBMS, thereby eliminating the need to make changes in the program segments that reference the changes data type) Any change in the parent node is automatically reflected in the child node so, the integrity of data is maintained. Database integrity – always a link between parent and child Efficiency – very efficient when it contains a large volume of data in 1:M relationships and whose relationships are fixed over time
The Hierarchical Model ( continued ) Disadvantages over a file system Complex relationships are not supported. As it does not support more than one parent of the child node so if we have some complex relationship where a child node needs to have two parent node then that can't be represented using this model. If a parent node is deleted then the child node is automatically deleted Lacks structural independence Complex applications programming and use – programmers and end users must know precisely how the data are physically distributed within the database Implementation limitations – difficult to support M:N relationships
Network model 26
Network Model—Basic Structure Resembles hierarchical model Collection of records in 1:M relationships A relationship is called a Set Composed of at least two record types Owner Equivalent to the hierarchical model’s parent Member Equivalent to the hierarchical model’s child A record can appear as a member in more than one set i.e., a member may have multiple owners
2- 28 A Network Data Model
2- 29 Ability to Merge more Relationships: In this model, as there are more relationships so data is more related. This model has the ability to manage one-to-one relationships as well as many-to-many relationships . Many paths: As there are more relationships so there can be more than one path to the same record. This makes data access fast and simple . Circular Linked List: The operations on the network model are done with the help of the circular linked list. The current position is maintained with the help of a program and this position navigates through the records according to the relationship.
The Network Data Model Advantages Conceptual simplicity Handles more relationship types Data access flexibility – no need for a preorder traversal Promotes database integrity – must first define the owner and then the member record Data independence Conformance to standards The data can be accessed faster as compared to the hierarchical model. This is because the data is more related in the network model and there can be more than one path to reach a particular node. So the data can be accessed in many ways. As there is a parent-child relationship so data integrity is present. Any change in parent record is reflected in the child record .
The Network Data Model ( continued ) Disadvantages System complexity Lack of structural independence As more and more relationships need to be handled the system might get complex. So, a user must be having detailed knowledge of the model to work with the model . Any change like updating, deletion, insertion is very complex.
Relational model 32
The Relational Model Developed by Codd (IBM) in 1970 Considered ingenious but impractical in 1970 Conceptually simple Computers lacked power to implement the relational model Today, microcomputers can run sophisticated relational database software
The Relational Model: Basic Structure Relational Database Management System (RDBMS) Performs same basic functions provided by hierarchical and network DBMS systems, plus other functions RDBMS handles all the complex physical details Most important advantage of the RDBMS is its ability to let the user/designer operate in a human logical environment
The Relational Model:Basic Structure Table (relations) Matrix consisting of a series of row/column intersections Related to each other by sharing a common entity characteristic Relational schema Visual representation of relational database’s entities, attributes within those entities, and relationships between those entities
Database Systems 6e / Rob & Coronel 2- 36 Linking Relational Tables
Relational Table Stores a collection of related entities Resembles a file Relational table is purely logical structure How data are physically stored in the database is of no concern to the user or the designer This property became the source of a real database revolution
Database Systems 6e / Rob & Coronel 2- 38 A Relational Schema
A Sample Relational Database
Database Systems 6e / Rob & Coronel 2- 40 The Relational Model Advantages Structural independence – changes in the relational data structure do not affect the DBMS’s data access in any way Improved conceptual simplicity by concentrating on the logical view Easier database design, implementation, management, and use Ad hoc query capability - SQL Powerful database management system
Database Systems 6e / Rob & Coronel 2- 41 The Relational Model ( continued ) Disadvantages Substantial hardware and system software overhead Can facilitate poor design and implementation May promote “islands of information” problems
Object Oriented 42
Object Oriented Data Model— Basic Structure Object: abstraction of a real-world entity Attributes describe the properties of an object Objects that share similar characteristics are grouped in classes Classes are organized in a class hierarchy Inheritance is the ability of an object within the class hierarchy to inherit the attributes and methods of classes above it
A Comparison of the OO Model and the ER Model
The Object Oriented Model Advantages Adds semantic content Visual presentation includes semantic content Database integrity Both structural and data independence
The Object Oriented Model ( continued ) Disadvantages Slow pace of OODM standards development Complex navigational data access Steep learning curve High system overhead slows transactions Lack of market penetration
Data Models: A Summary Each new data model capitalized on the shortcomings of previous models Common characteristics: Conceptual simplicity without compromising the semantic completeness of the database Represent the real world as closely as possible Representation of real-world transformations (behavior) must be in compliance with consistency and integrity characteristics of any data model
Data Integrity Ensures that the stored data are consistent and correct Easy to define global rules customer_age > 21 years number_of_credits < 18 Can allow multiple users to access data without compromising on data integrity
Data Redundancy In this storage model, the same information may get duplicated in two or more files. This may lead to higher storage and access cost. it also may lead to data inconsistency. For Example, assume the same data is repeated in two or more files. If a change is made to data stored in one file, other files also needs to be change accordingly. Example : Assume employee details such as first name, last name, emailed are stored in employee details file and employee salary file. If a change needs to be made to emailed, both employee details file and emplyee_salary file need to be updated otherwise it will lead to inconsistent data.
4- 50 Data Redundancy, Data Integrity When all copies of redundant data are not updated consistently, a data integrity problem exists.