Data, Information, Database, and DBMS Overview
Data, Information, Database, and DBMS Overview
Data:
Data refers to raw, unprocessed facts or figures that are often represented as numbers, text, images, or other forms.
It lacks context and meaning until it is processed or organized.
For example, a list of numbers (5, 10, 15, 20) is data without any specific meaning.
2. Information:
Information is processed data that has been organized, structured, and given context, making it meaningful and useful. It provides
insights, knowledge, and understanding.
For example,
if we label the list of numbers as "Test Scores" and associate it with students, such as "Student A scored 5, Student B scored 10," it
becomes information.
1
Database and DBMS
Database:
❑A **database** is a structured and organized collection of data
that is stored electronically, designed to be easily accessed,
managed, and updated. It serves as a central repository for storing,
retrieving, and managing a wide range of information, such as text,
numbers, images, and more.
or
A database is a structured collection of organized data that is stored
electronically and can be easily accessed, managed, and queried. It
provides a centralized and efficient way to store and retrieve
information. For example, a database for a school might store
information about students, including their names, ages, grades, and
test scores.
❑Databases are used in various applications, from simple data
storage to complex systems that support critical business operations
and decision-making processes.
❑They provide a systematic way to store and organize data for
efficient querying, analysis, and manipulation.
2
Database and DBMS
Database:
Features of database
• Data can be stored in well organized form.
• We can retrieve data in no time.
• Same data can be used by different users.
• Data can be filtered.
• Since the data in the database is managed by software, it is
highly secured.
• We can perform operations on data.
• With the help of a database, our data can be linked and shared
with third party applications.
3
Database and DBMS
DBMS:
4
Database and DBMS
DBMS objectives:-
5
Traditional file storage system
Meaning:
In traditional file systems, data is stored in various formats such as text files, spreadsheets, or binary files, and is
managed manually or by application programs that directly access and manipulate these files.
Or
A traditional file-based storage system in the context of databases refers to the approach of storing and managing
data using files directly on the operating system without the use of a database management system (DBMS).
In this system, data is stored in individual files, such as text files, CSVs, or binary files, and is organized and accessed by
custom application programs.
Example:
A common example is storage of employees records using multiple text files (we used in C) or Ms excel(spreadsheets).
6
Traditional file storage system
Limitations:
Data Organization: Data is stored in separate files, usually in formats like plain text, CSV(Comma-Separated Values. ), or binary. Each
application has its own set of files, and the organization is often specific to the application's requirements.
Data Redundancy: There is a high likelihood of data redundancy, as the same data might be stored in multiple files across
different applications, leading to unnecessary duplication.
Data Inconsistency: Due to redundancy and lack of central control, updates to data are not automatically synchronized across
all files, leading to inconsistencies.
Lack of Data Integrity: File-based systems do not enforce data integrity constraints, such as primary keys or foreign keys,
which can lead to data anomalies and errors.
Data Security: Security measures are basic, often limited to file permissions set by the operating system. There is no fine-
grained control over who can view or modify specific pieces of data.
Backup and Recovery Challenges: Managing backups and data recovery in traditional file-based systems is usually manual
and lacks the robust features of automated backup and recovery found in modern DBMS.
Scalability Issues: As the volume of data grows, managing and maintaining file-based systems becomes increasingly difficult.
Searching, updating, and maintaining large volumes of data are inefficient and slow.
7
Table, Field, Record, objects, primary key, alternate key,
candidate key
Table:
Publicatio
In a database, a table is a collection of related data organized Book ID Title Author Genre n Year
into rows and columns.
To Kill a
Each row represents a record or data entry, while each column 101 Mockingbir Harper Lee Fiction 1960
contains a specific attribute or field of the data.
d
Tables are used to store structured data in a tabular format,
making it easier to organize and retrieve information. George Science
102 1984 1949
Orwell Fiction
Example:
Consider a database for a library. The "Books" table could be Pride and Jane
103 Romance 1813
structured as follows: Prejudice Austen
8
Table, Field, Record, objects, primary key, alternate key, candidate key
Field: Publicat
In the context of the example table provided earlier ("Books" table), a field refers to a Book ID Title Author Genre ion Year
single data element within a column of the table. Each field represents a specific attribute
or characteristic of the data being stored. In the "Books" table, each column represents a To Kill a
Harper
field, and each cell within a column corresponds to a specific field value for a particular 101 Mockin Fiction 1960
record. Lee
gbird
For instance, in the "Books" table example: George Science
102 1984 1949
•The "Title" column represents the "Title" field, containing titles of different books. Orwell Fiction
•The "Author" column represents the "Author" field, containing names of authors. Pride
and Jane Romanc
•The "Genre" column represents the "Genre" field, containing different genres of books. 103 1813
Prejudic Austen e
•The "Publication Year" column represents the "Publication Year" field, containing the e
years when the books were published.
The F. Scott
Each field contains individual pieces of data that collectively make up the information 104 Great Fitzgera Classic 1925
stored in the table. Fields provide a way to categorize and organize data within a
columnar structure, enabling efficient data management and retrieval in a database. Gatsby ld
9
Table, Field, Record, objects, primary key, alternate key, candidate key
Records: Publicat
Book ID Title Author Genre ion Year
A record refers to a complete set of data representing an individual entity or item in
the table. It consists of a collection of field values that correspond to the attributes To Kill a
or characteristics of that entity. Harper
101 Mockin Fiction 1960
Lee
Each row in the table represents a unique record, and the combination of values in gbird
the fields within that row provides a comprehensive description of the entity. George Science
102 1984 1949
For instance, in the "Books" table example:
Orwell Fiction
Pride
•The first row (record) with the values: Book ID = 101, Title = "To Kill a and Jane Romanc
Mockingbird," Author = "Harper Lee," Genre = "Fiction," Publication Year = 1960, 103 1813
represents a complete record for the book "To Kill a Mockingbird." Prejudic Austen e
e
•Similarly, each subsequent row represents a distinct record for each book in the
table, containing specific values for attributes like title, author, genre, and The F. Scott
publication year. 104 Great Fitzgera Classic 1925
Gatsby ld
10
Table, Field, Record, objects, primary key, alternate key, candidate key
Objects: Publicat
An object refers to a database element that encapsulates both data and the operations that can
Book ID Title Author Genre ion Year
be performed on that data. Objects provide a way to organize and manage various aspects of a To Kill a
database system, Including data storage, retrieval, manipulation, and security. Harper
101 Mockin Fiction 1960
Lee
Some of the examples of database gbird
objects are: table, views, index etc. George Science
102 1984 1949
Orwell Fiction
• Table : It is used to store information.
Pride
• View : It is logically representing subset of data from one or more tables.
and Jane Romanc
103 1813
• Sequence : It is used to generate primary key values. Prejudic Austen e
e
• Index : It is used to Improve the performance of queries
The F. Scott
• Synonym : It is used to gives alternate name to object.
104 Great Fitzgera Classic 1925
Gatsby ld
11
Table, Field, Record, objects, primary key, alternate key, candidate key
Files: Publicat
An object a file refers to a collection of related records or data stored as a unit. Files are used
Book ID Title Author Genre ion Year
to organize and store data in a structured manner, and they can be considered as a container To Kill a
that holds data records. Each file contains records that share a common structure, such as Harper
fields or attributes, and represent a specific type of information. 101 Mockin Fiction 1960
Lee
gbird
For example, in a traditional file-based system:
George Science
102 1984 1949
•A "Customer" file may store records about customers, including their names, Orwell Fiction
addresses, and contact details.
Pride
and Jane Romanc
103 1813
Prejudic Austen e
e
The F. Scott
104 Great Fitzgera Classic 1925
Gatsby ld
12
Table, Field, Record, objects, primary key, alternate key, candidate key
First Date of
Key: Student ID Name Last Name Birth Grade
In a database, a key is a field or combination of fields that uniquely 2005-03-
identify a record or row within a table. Keys are crucial for ensuring data 101 John Smith 10
15
integrity, enabling efficient data retrieval, and establishing relationships
between different tables. 2004-07-
102 Emily Johnson 11
20
There are several types of keys, including primary keys, foreign keys, and
candidate keys. 2005-01-
103 Michael Brown 10
10
Example:
Consider a "Students" table in a school database:
In this "Students" table, the "Student ID" field uniquely identifies each
student. It is an example of a primary key. A primary key ensures that
each student has a unique identifier, and it is used to uniquely identify and
access individual records.
13
Table, Field, Record, objects, primary key, alternate key, candidate key
Primary Key:
❑In a database, a primary key is a unique identifier for each record or
row within a table.
❑It ensures that each record in the table has a distinct and Customer First Last
unambiguous way of identification. A primary key enforces data ID Name Name Email Phone
integrity by preventing duplicate or null values in the key field, and it
serves as the basis for establishing relationships between tables. john@exa 555-123-
101 John Smith
[Link] 456
Example: emily@ex
555-987-
Consider a "Customers" table in an online retail database: 102 Emily Johnson [Link]
654
m
In this "Customers" table, the "Customer ID" field is designated as the michael@
primary key. Each customer is uniquely identified by their "Customer 555-456-
ID." This primary key ensures that each customer record has a distinct 103 Michael Brown example.c
789
identifier, preventing duplicate entries and maintaining data integrity. om
------------------------*------------------------------------------------ Note:
Data integrity in a database refers to the accuracy, consistency, and reliability 1. No null values
of data stored within the database. It ensures that the data remains accurate and 2. Can be deleted
reliable throughout its lifecycle, from creation to deletion. Maintaining data
integrity is crucial for making informed decisions based on reliable information. 3. Can be updated; but should not be done
4. Helps in indexing , in relationship and consistency
5. A table can have only one primary key.
14
Table, Field, Record, objects, primary key, alternate key, candidate key
15
Table, Field, Record, objects, primary key, alternate key, candidate key
16
Table, Field, Record, objects, primary key, alternate key, candidate key
candidate Key:
First
A candidate key in a database is a subset of attributes (columns)
Student ID Name Last Name Age Gender
within a table that can uniquely identify each record. Unlike a super
key, a candidate key is minimal, meaning that no subset of its 101 John Smith 20 Male
attributes can uniquely identify records. Candidate keys are potential
choices for the primary key of a table. It is a minimal super key. 102 Emily Johnson 19 Female
103 Michael Brown 21 Male
Example:
18
Table, Field, Record, objects, primary key, alternate key, candidate key
foreign Key: Student table: courses table
20
Disadvantages of DBMS
Implementing and managing a DBMS can be complex, requiring a learning [Link] Overhead: While DBMS systems offer advanced features,
curve for database administrators and users. Understanding database they can introduce performance overhead. Complex queries and
concepts, query languages, and system administration can be time- transactions might impact system performance, leading to slower response
consuming. times.
[Link]: Acquiring and implementing a DBMS involves costs, including [Link] Lock-In: Choosing a specific DBMS vendor can result in vendor
licensing, hardware, training, and maintenance expenses. Small businesses lock-in, making it challenging to switch to a different system without
or individuals might find these costs prohibitive. significant migration efforts. Changing vendors may require rewriting
queries and adapting applications.
[Link] Point of Failure: A centralized DBMS can become a single point
of failure. If the DBMS experiences downtime or data corruption, it can
disrupt multiple applications and users relying on it.
21
SQL (Structured Query Language)
SQL:-
Structured Query Language (SQL) is a domain-specific language 4. Data Control Language (DCL): DCL commands manage access to
used for managing and manipulating relational databases. It provides a the database. They include commands like GRANT (to provide
standardized way to interact with databases, enabling users to create, specific privileges to users) and REVOKE (to remove privileges).
retrieve, update, and delete data. SQL is essential for tasks such as
defining database structures, querying data, and performing various
database operations. 5. Data Transaction Language (DTL): DTL commands manage
transactions, ensuring data integrity and consistency. Commands like
COMMIT (to confirm changes) and ROLLBACK (to undo changes)
Key aspects of SQL include: are part of DTL.
1. Data Definition Language (DDL):SQL's DDL allows users to define SQL is not limited to a specific database system and is supported by
and manage the structure of a database. It includes commands for most relational database management systems (RDBMS), including
creating tables, specifying data types, establishing relationships, and MySQL, PostgreSQL, Oracle, SQL Server, and SQLite. It provides a
defining constraints. E.g. create,drop,alter etc standardized way to interact with databases, regardless of the
2. Data Manipulation Language (DML): DML commands are used to underlying system.
manipulate data within the database. These commands include INSERT
(to add new records), UPDATE (to modify existing records), and SQL serves as a powerful tool for database management, offering a
DELETE (to remove records). comprehensive set of commands for defining, manipulating, querying,
3. Data Query Language (DQL): DQL is used to retrieve data from the and controlling data in relational databases. It plays a crucial role in
database. The most commonly used DQL command is SELECT, which enabling efficient and structured interaction with databases for various
allows users to retrieve specific columns or rows based on conditions. applications and users.
22
Database model
D ATA B A S E M O D E L
It is a conceptual representation that defines the structure,
relationships, and constraints of a database system.
I t p r o v i d e s a b l u e p r i n t f o r d e s i g n i n g a n d o rg a n i z i n g d a t a w i t h i n
a database.
Database models help developers and designers plan the layout of
data and how it will be accessed, stored, and manipulated.
D i ff e r e n t t y p e s o f d a t a b a s e m o d e l s c a t e r t o s p e c i f i c r e q u i r e m e n t s
and scenarios.
23
Database model types
D ATA B A S E M O D E L
❑ It is a conceptual representation that defines the structure,
relationships, and constraints of a database system.
❑ I t p r o v i d e s a b l u e p r i n t f o r d e s i g n i n g a n d o rg a n i z i n g d a t a
within a database.
❑ Database models help developers and designers plan the layout
of data and how it will be accessed, stored, and manipulated.
D i ff e r e n t t y p e s o f d a t a b a s e m o d e l s c a t e r t o s p e c i f i c
requirements and scenarios.
24
Database model types
Hierarchical Database Model:
❑ The Hierarchical Database Model is a way of organizing data in a tree-like structure, where records are connected to one another through links.
❑ Each record is made up of fields, and each field contains only one value. In this model, each child record can have only one parent, but each
parent can have multiple children.
❑ To retrieve data from a hierarchical database, you must traverse the tree starting from the root node.
❑ This model was developed by IBM in the 1960s and was used in early mainframe DBMS. The relationships between records form a tree-like
structure, which is simple but inflexible because the relationships are limited to one-to-many.
Examples of hierarchical database systems include the IBM Information Management System (IMS) and RDM Mobile.
Advantages:
[Link]: The hierarchical model is straightforward and easy to understand, making it suitable for simple data structures.
[Link]: Retrieval of data is efficient when following a predefined path from parent to child.
[Link] Access: Direct access to records using pointers ensures quick data access.
[Link] Integrity: Ensures data integrity by maintaining strict parent-child relationships.
25
Database model types
Hierarchical Database Model:
Disadvantages:
organization
[Link] of Flexibility: The rigid parent-child relationship limits the
model's flexibility, making it challenging to represent complex
relationships.
27
Database model types
Network database enforce data integrity by maintaining strict parent-child
connections.
Advantages:
[Link] Relationships: The model is well-suited for
representing complex relationships between entities,
including many-to-many relationships.
[Link]: It allows records to have multiple parent and
child records, providing greater flexibility in data
modeling.
[Link] Retrieval: Navigating the network is efficient
for retrieving data, especially when following predefined
paths.
[Link] Data: The model can represent both
hierarchical and non-hierarchical data structures, providing
a broader range of applications.
[Link] Integrity: The owner/member relationships
28
Database model types
Network database
disadvantages:
[Link] Difficulty: Navigating the network can be
difficult as queries require specifying paths and relationships.
[Link] Queries: Complex queries involving multiple
relationships can be challenging to express, limiting the query
capabilities.
[Link] Issues: Any changes to the structure may
require updates to multiple records and pointers, making
maintenance more complicated.
[Link] of Standards: The model lacks standardization
compared to the relational model, making it less common in
modern database systems.
29
Database model types
Relational database:-
❑ A relational database (RDB) is a collective set of multiple
data sets organized by tables, records and columns. RDBs
establish a well-defined relationship between database
tables.
❑ Tables communicate and share information, which
facilitates data search ability, organization and reporting.
❑ Relational Model is the most widely used model. In this
model, the data is maintained in the form of a two-
dimensional table.
❑ All the information is stored in the form of row and
columns.
❑ The basic structure of a relational model is tables. So, the
tables are also called relations in the relational model.
30
Database model types
Relational database:-
Advantages:
1 Data Integrity: Relational databases enforce data integrity
through constraints such as primary keys, foreign keys, and
unique constraints, ensuring accurate and reliable data storage.
2. Flexibility: The model allows for easy data manipulation and
querying. Users can perform complex queries using the
structured query language (SQL) to retrieve, update, and analyze
data.
3. Normalization: Relational databases support data
normalization, reducing data redundancy and ensuring efficient
storage. This leads to improved data consistency and minimizes
update anomalies.
4. Scalability: Relational databases can handle large amounts of
data and are scalable. They can be scaled vertically (adding more
resources to a single server) or horizontally (distributing data
across multiple servers).
❑.
31
Database model types
Relational database:-
Disadvantages:
[Link] Curve: Developers and users need to learn SQL and
understand the relational model's concepts, which might require a
learning curve, particularly for those new to databases.
[Link] Issues: Heavy concurrent access by multiple users can
lead to locking and blocking issues, affecting the system's
responsiveness and performance.
[Link] Retrieval Complexity: Querying data from multiple tables
using joins can be complex and may require optimizing query
performance, especially in complex database structures.
32
Database model types
E-R database model:-
❑ The Entity-Relationship (ER) model is a conceptual framework used in
database design to represent and describe the structure and relationships
between data entities within a database.
❑ It helps database designers and developers understand and plan how data
should be organized and related to one another in a database system.
❑ The ER model is typically represented using diagrams that consist of entities,
attributes, and relationships.
33
Database model types
Here are the key components of the ER model:
[Link]: An entity is a real-world object, concept, or thing that is distinguishable from other objects. In a
database, an entity is typically represented as a table. Each row in the table corresponds to a specific instance
of that entity, and each column represents an attribute of the entity. For example, in a library database, "Book"
and "Author" could be entities.
[Link]: An attribute is a characteristic or property that describes an entity. It is represented as a column in
an entity table. Attributes provide details about the entity and help define its properties. For instance, in the
"Book" entity, attributes could include "Title," "ISBN," "Publication Year," and so on.
[Link]: A relationship defines how two or more entities are connected or associated with each other.
Relationships are represented as lines connecting entities in an ER diagram. They describe the nature of the
interaction between entities. For example, in a library database, a "Has Authored" relationship may connect
the "Author" entity with the "Book" entity to show which authors have written which books.
[Link]: Cardinality in the ER model specifies the number of instances of one entity that can be related to
another entity through a relationship. Common cardinalities include one-to-one (1:1), one-to-many (1:N), and
many-to-many (N:M). For instance, a "Student" entity might have a one-to-many relationship with a "Course"
entity, indicating that one student can enroll in multiple courses, but each course is taken by multiple students.
Some other components can be weak entity,key strong entity etc
34
Database model types
Example:
35
Normalization
Definition:-
Normalization is the process of organizing data in a database. This includes creating tables and
establishing relationships between those tables according to rules designed both to protect the data
and to make the database more flexible by eliminating two factors: redundancy and inconsistent
dependency.
Following rules are applied when we normalize relations.
[Link] repeating groups
[Link] repeating data
[Link] columns not depending on key.
[Link] independent multiple relationship
[Link] semantically related multiple relationships
36
Types:
Following are the types of normalization:-
1. First Normal Form (1 NF)
2. Second Normal Form (2 NF)
3. Third Normal Form (3 NF)
4. BCNF(Boyce Codd Normal Form): Also called 3.5 Normal form
5. Fourth Normal Form ( 4 NF)
6. Fifth Normal Form (5 NF)
7. Sixth Normal Form (6 NF):proposed
37
First normalization:-
Meaning:-
A table is said to be in 1N if
1. There is no repeating group/field
2. Each cell contains atomic value.
Here atomic means single value which further cannot be divided.
Example: Here we are taking employee table.
Employee_no Employee_name department
1 Rama IT, Security
2 Shyam HR
3 Samana Accountant
I
In this table, the department is storing two different values which are not atomic.
38
First normalization(continued…)
In this table we can see that first condition is fulfilled i.e.
->it contains no repeating field.
->Whereas second is violated i.e. it contains two values for same record. Let’s remove this by splitting the
master table into following tables.
Table: employee Table :department
39
second normalization:-
Meaning:-
A table is said to be in 2N if
1. it is in 1N
2. There is no column which is not dependent on key/primary key.
Or all non-key attributes are fully dependent on primary key.
Example: Here, we are taking a table ‘location’.
Cutomer_id Store_id Store_location
1 1 Mahaboudhha
2 2 Newroad
3 3 Bagbazar
40
second normalization(continued…)
In this table we can see that first condition is fulfilled .
->The Location table possesses a composite primary key customer_id, store_id. The non-key attribute is store_location. In this case, store_location only depends on
store_id, which is a part of the primary key. Hence, this table does not fulfill the second normal form. Lets remove this by changing above table into following tables.
Customer store
41
Third normalization
Meaning:-
A table is said to be in 3N if
1. If it is in 2N
2. If there is no transitive functional dependency.
Transitive functional dependency: X -> Z is a transitive dependency if the following three functional dependencies hold true:
X->Y
Employee_no Salary_Slip_no Emp_name Emp_salary
Y does not ->X
1 213 Amar 9000
Y->Z
2 214 Daya 30000
Let’s take an example.
3 215 Samya 40000
In this table, employee_no determines salary_slip_no, salary_slip_no determines emp_name. therefore employee_no
determines emp_name. so we can say this table is having transitive problem. To remove it we break it into following tables.
42
Third normalization(continues…)
Employee_no Salary_Slip_no Emp_name Emp_salary
1 213 Amar 9000
2 214 Daya 30000
3 215 Samya 40000
Employee_info employee_salary
Employee_no Salary_Slip_no Emp_salary Salary_Slip_no Emp_name
1 213 9000 213 Amar
2 214 30000
214 Daya
3 215 40000
215 Samya
43
Centralized VS Distributed database
CENTRALIZED DATABASE DISTRIBUTED DATABASE
44
Centralized vs distributed database
CENTRALIZED DISTRIBUTED
45
Database security
Definition:-
Database security refers to the range of tools, controls, and measures designed to establish and
preserve database confidentiality, integrity, and availability. This will focus primarily on confidentiality
since it's the element that's compromised in most data breaches.
Measures to secure database:
Authentication and Authorization:
•Authentication: This is the process of verifying the identity of users accessing the database. It ensures
that only authorized users are allowed to log in. Strong authentication methods like multi-factor
authentication (MFA) enhance security.
•Authorization: Once a user is authenticated, authorization determines what actions they are allowed to
perform within the database. This includes specifying which tables, views, and operations (e.g.,
SELECT, INSERT, UPDATE, DELETE) they can access.
46
Database security
Encryption:
•Data Encryption: Encrypting data at rest and in transit prevents unauthorized access even if someone gains access
to the physical storage or intercepts the data in transit. This can be achieved using technologies like Transparent
Data Encryption (TDE) for storage and SSL/TLS for data transmission.
•End-to-End Encryption: Ensures that data is encrypted from the point it's entered into the system until it's
accessed, minimizing the exposure of sensitive information.
Access Controls:
•Role-Based Access Control (RBAC): Assigns users to roles, and each role has specific privileges. This reduces the
risk of excessive privileges being assigned to individuals.
•Least Privilege Principle: Users should have the minimum level of access required to perform their tasks. This
limits the potential damage caused by compromised accounts.
•Dynamic Access Control: Access rights can be determined by contextual factors like user location, time, and
network conditions, enhancing security.
47
Database security
Auditing and Monitoring:
•Auditing: Regularly auditing the database involves recording activities like logins, data changes, and permission
modifications. It helps track who did what and when, aiding in forensic analysis in case of security incidents.
•Monitoring: Real-time monitoring of database activities helps detect suspicious behavior or unauthorized access
attempts. Intrusion detection systems (IDS) and intrusion prevention systems (IPS) are valuable tools for this
purpose.
Database Patching and Updates:
•Regularly applying patches and updates to the database management system (DBMS) and any associated software
is crucial to address known vulnerabilities. Hackers often exploit outdated software to gain unauthorized access.
•Additionally, staying informed about security advisories and best practices for your specific DBMS helps you
maintain a secure environment.
Some others are:Regular Backups and Disaster Recovery Plans, Database Firewall, Secure Coding Practices etc.
48
DBA
Definition:
DBA stands for Database Administrator. A Database Administrator is a
professional responsible for managing, configuring, and maintaining an
organization's database systems.
Their primary role is to ensure that databases run smoothly, efficiently,
and securely to support the data needs of an organization. Here are some
of the key roles and responsibilities of a DBA:
[Link] Installation and Configuration: DBAs are responsible for
installing and configuring database management systems (DBMS) such as
Oracle, MySQL, SQL Server, or PostgreSQL. They ensure that the database
software is set up correctly and optimized for performance.
[Link] Modeling: DBAs design and implement database schemas and data
models that efficiently organize and store data. This includes defining
tables, relationships, and data integrity constraints.
[Link] Tuning: DBAs monitor database performance and take
proactive measures to optimize it. They may tune SQL queries, adjust
server settings, and allocate resources to ensure fast and efficient data
retrieval.
49
DBA
Security Management: DBAs play a crucial role in maintaining the security of the database. They set up user access
controls, encryption, and authentication mechanisms to protect sensitive data from unauthorized access and
breaches.
Backup and Recovery: DBAs develop and implement backup and recovery strategies to ensure data is protected
from loss or corruption. They regularly back up databases and create plans for restoring data in case of failures.
Data Maintenance and Cleanup: DBAs manage data growth by archiving or deleting obsolete data, optimizing
storage, and ensuring data quality and consistency.
Database Monitoring: They continuously monitor database health, looking for issues like bottlenecks, errors, or
anomalies, and take corrective actions to maintain system availability.
Capacity Planning: DBAs forecast future database storage and performance needs, ensuring that the infrastructure
can accommodate growing data requirements.
Disaster Recovery Planning: DBAs create and test disaster recovery plans to minimize downtime in case of
catastrophic events like hardware failures or natural disasters.
50
Database integrity
In the context of databases, "integrity" refers to the accuracy, consistency, and reliability of the data stored within
the database. It ensures that the data is maintained in a valid and dependable state throughout its lifecycle.
Database integrity is typically enforced through various types of constraints and rules. Here are the primary types of
integrity in a database:
[Link] Integrity:
1. Primary Key Constraint: This type of integrity ensures that each row (or record) in a database table is uniquely
identifiable. It is enforced by designating one or more columns as the primary key, which must contain unique and non-
null values.
[Link] Integrity:
1. Foreign Key Constraint: Referential integrity ensures that relationships between tables are maintained. It is enforced
through foreign key constraints, which specify that values in one table's foreign key column must correspond to values in
another table's primary key column.
51
Database integrity
Domain Integrity:
•Check Constraints: Domain integrity ensures that data within a column adheres to a specified set of rules. Check
constraints are used to define these rules, such as limiting values within a certain range or format.
Null Integrity:
•NOT NULL Constraint: Null integrity ensures that specific columns in a table cannot contain NULL values unless
explicitly allowed. The NOT NULL constraint enforces this rule.
52
Joining tables
CREATE TABLE Students ( StudentID INT PRIMARY KEY, FirstName INSERT INTO Students (StudentID, FirstName, LastName, Email)
VARCHAR(50), LastName VARCHAR(50), Email VARCHAR(100), ); VALUES (1, 'John', 'Doe', 'johndoe@[Link]'), (2, 'Alice',
'Smith', 'alicesmith@[Link]'), (3, 'Bob', 'Johnson',
CREATE TABLE Courses ( CourseID INT PRIMARY KEY, CourseName 'bobjohnson@[Link]’);
VARCHAR(100), Instructor VARCHAR(100), );
INSERT INTO Courses (CourseID, CourseName, Instructor) VALUES
CREATE TABLE StudentCourses ( StudentID INT, CourseID INT, (101, 'Introduction to Programming', 'Prof. Anderson'), (102,
RegistrationDate DATE, PRIMARY KEY (StudentID, CourseID), 'Database Management Systems', 'Prof. Wilson'), (103, 'Web
FOREIGN KEY (StudentID) REFERENCES Students(StudentID), Development Fundamentals', 'Prof. Davis’);
FOREIGN KEY (CourseID) REFERENCES Courses(CourseID) );
INSERT INTO StudentCourses (StudentID, CourseID,
RegistrationDate) VALUES (1, 101, '2023-01-15'), (1, 102, '2023-02-
02'), (2, 101, '2023-01-20'), (3, 102, '2023-01-25'), (3, 103, '2023-02-
10');
53
Joining tables
SELECT [Link], [Link], [Link], [Link], [Link] FROM Students s
WHERE [Link] = 1;
----------------------------------------------------------------------------------------------------------------------------------------
Or
SELECT [Link], [Link], [Link], [Link], [Link]
FROM Students s, StudentCourses sc, Courses c
WHERE [Link] = 1
AND [Link] = [Link]
AND [Link] = [Link];
54
Thank you for your attention!
55