Database
Database
Database
Data base
data
Data: The value we get from real world measurement.
It is often used to represent specific information about people, places, things, or events, and
can help understand patterns, trends, and relationships related to the information being
collected.
DATA HIERARCHY
The data in a computer system are organized in a hierarchy known as the data
hierarchy chain.
The hierarchy in ascending order bits, bytes, fields, records, files and database.
A database is made up of records, records consist of fields, fields contain bytes, and bytes are
made up of bits.
1. Bit: A bit is a value that represents the presence or absence of an electronic signal and is
represented as a 1 or 0.
2. Byte: Eight bits make up a byte and a byte is required to represent a character (number,
alphabetic and so on) in a computer.
Ex: “BADASA= Six bytes= 6*8 bits, BADASA = 48 bits.
DATA HIERARCHY
Files for as many event and objects as the organization has are used to store information.
Each of the files containing various kinds of information is labelled and stored in one or more
cabinets.
The cabinets could be kept in safe places for security purpose (Cabinet Lockers).
Solution(Result)
The database and Database Management System (DBMS).
This approach solves the problems of the File-based Approach
Database Approach
A database is a collection of data that is organized and stored in a structured format,
allowing for easy access, manipulation, and analysis of the data.
A database is an electronic system that allows data to be easily accessed, manipulated and
updated.
A database is information that is set up for easy access, management and updating.
Databases are used for storing, maintaining and accessing any sort of data.
This will alleviate the problem of duplication and inconsistent data between different
applications.
system (DBMS) provides facilities for querying, data security and integrity, and allows simultaneous access to
Database management system: DBMS, refers to a software system used to create and manage databases.
System catalogue/Data dictionary: The description of the data in the database management system.
Database application: Database application refers to a program, or related set of programs, which use the
database management system to perform the computer-related tasks of a particular business function, such as
order processing.
Benefits of the database approach
1. Ease of application development
2. Minimal data redundancy: All data files are integrated into a composite data structure.
In practice, not all redundancy is eliminated, but at least the redundancy is controlled.
3. Enforcement of standards: The database administrator can define standards for …
4. Data can be shared. New applications can use existing data definitions.
5. Physical data independence:
Data descriptions are independent of the application programs.
Data is stored independently of the program that uses it.
Benefits of the database approach
6. Logical data independence: Data can be viewed in different ways by different users
7. Better modelling of real-world data: Databases are based on semantically rich data
models that allow the accurate representation of real-world in-formation.
6. Compactness
7. Speed
8. Less labor
Risks of the database approach
1. New specialized personnel: Need to hire or train new personnel e.g. database administrators
and application programmers.
3. Organizational conflict: Different departments have different information needs and data
representation.
The rows/ record hold the actual data, with one (or no) items per row.
Every record in a table has exactly the same structure, but of course different data.
Fundamental Database Concepts
2. Relationship: Relationships are THE reason why relational databases work so well.
In a relational databases, a relationship exists between two tables when one of them has a
foreign key that references the primary key of the other table.
Primary Key: is a special column or combination of columns that uniquely identifies each record (row) in the
Foreign Key: is used to reference the same record from another table.
3. Structured Query Language (SQL): is the de facto language used for the management and
2. Schema: The structure and organization of the data in the database, including the tables,
3. Query language: A language or interface that is used to retrieve and manipulate data in the
database.
4. Indexes: Data structures that are used to improve the performance of queries and searches in
the database.
Database Components
5. Transactions: A mechanism for ensuring the consistency and integrity of the data in the database.
6. Users: The individuals or application programs that access and manipulate the data in the database.
7. Security: Tools and mechanisms for controlling access to the data and protecting it from unauthorized
access or tampering.
8. Backup and recovery: Tools and procedures for protecting the data in the event of a failure /disaster.
9. Performance monitoring: Tools and techniques for monitoring the performance and usage of the
database and identifying and resolving any issues.
Roles in Database Design and Use
1. Data Administrator (DA): is responsible on management of data resources.
It involves in database planning, development, maintenance of standards policies and procedures at the conceptual and
logical design phases.
Should understand the user requirement and should choose how the user views the database.
Involve on the design phase before the implementation of the database system.
We have two distinctions of database designers, one involving in the logical and conceptual
design and another involving in physical design.
Roles in Database Design and Use
1. Logical and Conceptual DBD: Identifies data (entity, attributes and relationship) relevant to the organization.
Identifies constraints on each data.
Sees the database independent of any data model at conceptual level and consider one specific data model at
logical design phase.
2. Physical DBD: Take logical design specification as input and decide how it should be physically realized.
Map the logical data model on the specified DBMS with respect to tables and integrity constraints.
Determines the interface on how to retrieve, insert, update and delete data in the database.
The application could use any high level programming language according to the availability,
the facility and the required service.
Roles in Database Design and Use
4. End Users
Workers, whose job requires accessing the database frequently for various purposes
It includes:
A. Naive Users,
B. Sophisticated Users,
C. Casual Users
Only access the database based on their access level and demand.
B. Sophisticated Users: Are users familiar with the structure of the Database and facilities
of the DBMS?
Have complex requirements and higher level queries.
Have Are most of the time engineers, scientists, business analysts, etc.
A DBMS is software that is designed to store, manage, and retrieve data from a database.
The DBMS serves as the intermediary between the database and the users or application programs that
need to access the data.
It is responsible for managing the data stored in the database, including:
Storing and organizing the data
Enforcing data integrity
Providing access to the data for users and application programs.
It also provides tools and interfaces for creating, modifying, and querying the data in the database.
Components of DBMS environment
To design and use a database, there will be the interaction or integration of Hardware, Software,
Data, Procedure and People.
I. Hardware: are components that one can touch and feel.
II. Software: are collection of commands and programs used to manipulate the hardware to
perform a function.
III. Data: Operational and Metadata.
IV. Procedure: The rules and regulations on how to design and use a database.
V. People: the people that are responsible or play a role in designing, implementing, managing,
administering and using the resources in the database.
Advantages and Disadvantages of DBMS
Advantages of DBMS Disadvantages of DBMS
2) Data Control Language (DCL): To describe the ‘‘Rights & Permissions’’ across the Database system
DCL commands include Revoke and Grant used to retrieve previously stored and saved data.
3) Data Manipulation Language (DML): used to access and manipulate data in the Database.
These statements are commonly meant for handling user requests.
DML commands include Select, Insert, Update, Delete, Merge and Call.
It arranges data in either Top-Down or Down-Up flow and defines the flow through the
parent-child relationship.
2. One-to-Many a parent can have more than one child in a One-to-Many relationship
data is arranged in a graphical format and can be acquired through different data routes.
A child can have more than one parent and vice versa.
In this way, multiple relationships can be built in a Network Database System, permitting
enterprises to achieve efficiency.
2. Network Database System
Example:
TurboIMAGE,
It allows developers and programmers to normalize data and organize information as rationally independent
tables.
Example: DB2 and Informix Dynamic Server, Microsoft Access & SQL Server, RDB and Oracle.
4. Object-Oriented Database System
Diverse programming languages, such as Perl, Scala, .NET, Java, Python, JavaScript, Delphi,
Visual Basic and C++, are used by programmers to build relationships between variables and
establish schemas. Example: Cache, ConceptBase.cc, Db4o (Database 4 objects).
Database Models
Database Models are used to show:
How data is stored,
How it is connected,
How to access the DBMS that is nothing but its own structure.
It is also beneficial for the developers to understand the overall system by just looking at the “ER
diagram”.
1) Entity-Relationship Model/ ER model
Entity:- An entity is a real-world object, which is distinguishable from different objects.
Like it can be a place, concept, or thing.
Example:- Enrollment=000968347, Teacher, Building, etc
Entity Set: - Collection of entity is called entity set.
Example: - Employee Records table, Students Records table.
Relationship (Mapping): - The Relations between attributes of any two entity sets are called Mapping.
There are four types of relationships as follow: -
a) 1: 1 (One to One) Mapping
b) 1: M (One to Many) Mapping
c) M: 1 (Many toOne) Mapping
d) M: M (Many to Many) Mapping
2) Network Model
The network model is the same as the hierarchical model, there is the only difference is that
a “record can have more than one parent”.
For Example: In the example below, we can see that the node student has two parents i.e.
Dept and Library of college. Hence It is not possible in the hierarchical model.
3 Hierarchical Model
The hierarchical model was the first “DBMS model”.
The hierarchy starts from the root which has root data, and then it expands in the form of a
tree adding child node to the parent node and so on.
The hierarchical model easily describes some real-world relationships like Food Recipes, etc
Applications of Database Systems
Some of the most common applications of Database Systems or DBMS are listed below:
Telecommunication
Airlines
Human Resources
Banks
Education
Normalization: is the process of reorganizing data in a database so that it meets two basic
requirements:
There is no data redundancy: All data is stored in only one place
Data dependencies are logical: All related data items are stored together
Normalization may reduce system performance since data will be cross referenced from
many tables.
Thus de-normalization is sometimes used to improve performance, at the cost of reduced
consistency guarantees.
Normalization normally is considered as good if it is lossless decomposition.
Steps of Normalization:
We have various levels or steps in normalization called Normal Forms.
The level of complexity, strength of the rule and decomposition increases as we move from
one lower level Normal Form to the higher.
Normal form below represents a stronger condition than the previous one
Normalization towards a logical design consists of the following steps:
I. Un-Normalized Form: Identify all data elements
II. First Normal Form: Find the key with which you can find all data
III. Second Normal Form: Remove part-key dependencies. Make all data dependent on the whole
key.
IV. Third Normal Form: Remove non-key dependencies. Make all data dependent on nothing but
the key.
For most practical purposes, databases are considered normalized if they adhere to third
normal form.
First Normal Form (1NF)
Requires that all column values in a table are atomic (e.g., a number is an atomic value, while
a list or a set is not). We have two ways of achieving this: -
1. Putting each repeating group into a separate table and connecting them with a primary key
foreign key relationship.
2. Moving these repeating groups to a new row by repeating the common attributes. If so then find
the key with which you can find all data