Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
16 views74 pages

DBMS PPT 1 ENG

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 74

DBMS

UNIT 1

DBMS
AND
RELATIONAL
MODEL
TOPIC
 Database- System Applications - Purpose of
Database Systems
 View of Data
 Database Languages
 Database Design
 Database Engine
 Database and Application Architecture
 Database Users and Administrators
 History of Database Systems
 Structure of Relational Databases
 Database Schema - Keys - Schema Diagrams
 Relational Query Languages - The Relational
Algebra.
File System Approach

 File based systems were an early attempt to


computerize the manual system. It is also called a
traditional based approach in which a decentralized
approach was taken where each department stored and
controlled its own data with the help of a data
processing specialist.

 The main role of a data processing specialist was to


create the necessary computer file structures, and also
manage the data within structures and design some
application programs that create reports based on file
data.
 Some fields are duplicated in more than one file,
which leads to data redundancy. So to overcome this
problem, we need to create a centralized system, i.e.
DBMS approach.
INTRODUCTION
Data:
It is a collection of information. The
facts that can be recorded and which have
implicit meaning known as 'data'.
Example: Customer ----- 1.cname.
2.cno. 3.ccity.
Types of Data:
Parameters Structured Data Semi-Structured Data Unstructured Data

Data Structure The information The contained data and There is no predefined
and data have a information have organization for the
predefined organizational properties- but available data and
organization. are different from predefined information in the system or
structured data. database.

Technology Used Structured Data Semi-Structured Data works Unstructured data works on
words on the basis on the basis of Relational the basis of binary data and
of relational Data Framework (RDF) or the available characters.
database tables. XML.

Flexibility The data depends The data is comparatively less Schema is totally absent.
a lot on the flexible than unstructured Thus, it is the most flexible
schema. Thus, data but way more flexible of all.
there is less than the structured data.
flexibility.

Management of It has a mature It adapts the transaction from It consists of no


Transaction type of DBMS. It is not of mature management of transaction
transaction. Also, type. or concurrency.
there are various
techniques of
concurrency.

Management of It is possible to It is possible to version over It is possible to version the


Version version over graphs or tuples. data as a whole.
tables, rows, and
tuples.
Database:
A database is an organized collection
of data, so that it can be easily
accessed and managed.
You can organize data into tables,
rows, columns, and index it to make it
easier to find relevant information.
Database handlers create a
database in such a way that only one
set of software program provides
access of data to all the users.
The main purpose of the database is
to operate a large amount of
There are many databases available like
MySQL, Sybase, Oracle, MongoDB,
Informix, PostgreSQL, SQL Server, etc.
Modern databases are managed by the
database management system (DBMS).
SQL or Structured Query Language is used
to operate on the data stored in a
database. SQL depends on relational
algebra and tuple relational calculus.
A cylindrical structure is used to display
the image of a database.
Types of Database
RelationalDatabase
Cloud database
NoSQL Database
The Object-Oriented Databases
Graph Databases
Relational Database

 1970 - Present: It is the era of Relational Database


and Database Management. In 1970, the relational
model was proposed by E.F. Codd.
 Relational database model has two main terminologies
called instance and schema.
 The instance is a table with rows or columns
 Schema specifies the structure like name of the
relation, type of each column and name.
 This model uses some mathematical concept like set
theory and predicate logic.
 The first internet database application had been
created in 1995.
 During the era of the relational database, many more
models had introduced like object-oriented model,
object-relational model, etc.
Relational database
properties
Atomicity
Consistency
Integrity
Durability
Concurrency
Query processing
Cloud database
Cloud database facilitates you to store,
manage, and retrieve their structured,
unstructured data via a cloud platform.
This data is accessible over the Internet.
Cloud databases are also called a
database as service (DBaaS) because
they are offered as a managed service.
Some best cloud options are:
AWS (Amazon Web Services)
Snowflake Computing
Oracle Database Cloud Services
Microsoft SQL server
Google cloud spanner
Advantages of cloud database
Lower costs
Generally, company provider does not
have to invest in databases. It can
maintain and support one or more data
centers.
Automated
Cloud databases are enriched with a
variety of automated processes such as
recovery, failover, and auto-scaling.
Increased accessibility
You can access your cloud-based database
from any location, anytime. All you need is
just an internet connection.
NoSQL Database

A NoSQL database is an approach to design


such databases that can accommodate a wide
variety of data models. NoSQL stands for "not
only SQL." It is an alternative to traditional
relational databases in which data is placed in
tables, and data schema is perfectly designed
before the database is built.
 NoSQL databases are useful for a large set of
distributed data.
 Some examples of NoSQL database system
with their category are:
 MongoDB, CouchDB, Cloudant (Document-
based)
 Memcached, Redis, Coherence (key-value
store)
Advantage of NoSQL
 High Scalability
 NoSQL can handle an extensive amount of data because of scalability.
If the data grows, NoSQL database scale it to handle that data in an
efficient manner.
 High Availability
 NoSQL supports auto replication. Auto replication makes it highly
available because, in case of any failure, data replicates itself to the
previous consistent state.

Disadvantage of NoSQL
 Open source
 NoSQL is an open-source database, so there is no reliable standard for
NoSQL yet.
 Management challenge
 Data management in NoSQL is much more complicated than relational
databases. It is very challenging to install and even more hectic to
manage daily.
 GUI is not available
 GUI tools for NoSQL database are not easily available in the market.
 Backup
 Backup is a great weak point for NoSQL databases. Some databases,
like MongoDB, have no powerful approaches for data backup.
The Object-Oriented Databases
 The object-oriented databases contain data in
the form of object and classes. Objects are the
real-world entity, and types are the collection
of objects.
 An object-oriented database is a combination
of relational model features with objects
oriented principles. It is an alternative
implementation to that of the relational model.
 Object-oriented databases hold the rules of
object-oriented programming. An object-
oriented database management system is a
hybrid application.
 The object-oriented database model contains
the following properties.
Object-oriented programming
properties
Objects
Classes
Inheritance
Polymorphism
Encapsulation
Graph Databases

 A graph database is a NoSQL database. It is


a graphical representation of data. It
contains nodes and edges. A node
represents an entity, and each edge
represents a relationship between two
edges.
 Every node in a graph database represents
a unique identifier.
 Graph databases are beneficial for
searching the relationship between data
because they highlight the relationship
between relevant data.
 Graph databases are very useful
when the database contains a
complex relationship and
dynamic schema.
 It is mostly used in supply
chain management, identifying
the source of IP telephony.
Database Management System
(DBMS):
Itis a collection of programs that
enables user to create and
maintain a database.
In other words it is general-
purpose software that provides
the users with the processes of
defining, constructing and
manipulating the database for
various applications.
Database management System is
software which is used to store and
retrieve the database. For example,
Oracle, MySQL, etc.; these are some
popular DBMS tools.
DBMS provides the interface to perform
the various operations like creation,
deletion, modification, etc.
DBMS allows the user to create their
databases as per their requirement.
DBMS accepts the request from the
application and provides specific data
through the operating system.
DBMS contains the group of programs
Advantage of DBMS
Controls redundancy.
Data sharing.
Backup
Multiple user interfaces

Disadvantage of DBMS
Size.
Cost
Complexity
Instance and Schema
Instance:
 The data is stored for a particular amount of time and
is called an instance of the database.
 A tablew with rows and columns.
 Where Rows= Cardinality
Fields= Degree

 Example: Let's say we have a single table student in


the database; today, the table has 100 records, so
today, the instance of the database has 100 records.
We are going to add another 100 records to this table
by tomorrow, so the instance of the database tomorrow
will have 200 records in the table. In short, at a
particular moment, the data stored in the database is
called the instance; this change over time as and when
we add, delete or update data in the database.
Another Example:
Attributes
(Name of columns of the relation)

S_id name login age gpa

123 Sanjana sanj@cs. 23 8.2


ac.in

234 Alaina Alain@c 24 7.5


Cardinalit s.ac.in
y
345 Mani Mani@cs 24 7.8
.ac.in

Degree
C=3
(no. of Columns)
D=5
Schema
 A schema can be defined as the design of a
database. The overall description of the
database is called the database schema.

 It Specifies name of relations, Plus name and


type of each columns.

 It can be categorized into three parts. These are:


Schem
a

Physical Logical View


Schema Schema Schema
Schema Diagram
Physical schema :

 It can be defined as the design of a database at its physical


level.
 In this level, it is expressed how data is stored in blocks of
storage.

Logical schema :

 It can be defined as the design of the database at its logical


level. In this level, the programmers, as well as the database
administrator (DBA), work.
 At this level, data can be described as certain types of data
records that can be stored in the form of data structures.
However, the internal details (such as an implementation of
data structure) will be remaining hidden at this level.

View schema :

 It can be defined as the design of the database at the view


level, which generally describes end-user interaction with
database systems.
Database Languages in DBMS

 Create  Grant  Select  Commit


 Alter  Revoke  Insert  Rollback
 Drop  Update
 Truncate  Delete
 Rename  Merge
 Comment  Call
 Explain Plan
 Lock Table
1. Data Definition Language (DDL)
 DDL stands for Data Definition Language. I
 t is used to define database structure or pattern.
 It is used to create schema, tables, indexes, constraints,
etc. in the database.
 Using the DDL statements, you can create the skeleton of
the database.
 Data definition language is used to store the information
of metadata like the number of tables and schemas, their
names, indexes, columns in each table, constraints, etc.
Tasks Performed:
 Create: It is used to create objects in the database.
 Alter: It is used to alter the structure of the database.
 Drop: It is used to delete objects from the database.
 Truncate: It is used to remove all records from a table.
 Rename: It is used to rename an object.
 Comment: It is used to comment on the data dictionary.

These commands are used to update the database schema


2. Data Control Language (DCL)

DCL stands for Data Control Language.


It is used to retrieve the stored or saved data.
The DCL execution is transactional. It also has
rollback parameters. (But in Oracle database,
the execution of data control language does
not have the feature of rolling back.)

Tasks Performed:
Grant: It is used to give user access
privileges to a database.
Revoke: It is used to take back permissions
from the user.
3. Data Manipulation Language (DML)
Loaded:Â 16.51%

DML stands for Data Manipulation Language.


It is used for accessing and manipulating data in a database.
It handles user requests.
c

Tasks Performed:

•Select: It is used to retrieve data from a database.


•Insert: It is used to insert data into a table.
•Update: It is used to update existing data within a table.
•Delete: It is used to delete all records from a table.
•Merge: It performs UPSERT operation, i.e., insert or update
operations.
•Call: It is used to call a structured query language or a Java
subprogram.
•Explain Plan: It has the parameter of explaining data.
•Lock Table: It controls concurrency.
4. Transaction Control Language (TCL)

TCL is used to run the changes


made by the DML statement. TCL
can be grouped into a logical
transaction.
Tasks Performed:
Commit: It is used to save the
transaction on the database.
Rollback: It is used to restore the
database to original since the last
Commit.
Database Design

 Itis a collection of processes that facilitate the


designing, development, implementation and
maintenance of enterprise data management
systems.
 Properly designed database are easy to
maintain, improves data consistency and are
cost effective in terms of disk storage space.
The database designer decides how the data
elements correlate and what data must be
stored.
 The main objectives of database design in DBMS
are to produce logical and physical designs
models of the proposed database system.
Importance of Database Design
It helps produce database systems
1.That meet the requirements of the users
2.Have high performance.
Database design process in DBMS is crucial
for high performance database system.
Note, the genius of a database is in its
design. Data operations using SQL is
relatively simple
Database development life cycle

 The database development life cycle has a number of


stages that are followed when developing database
systems.
 The steps in the development life cycle do not
necessarily have to be followed religiously in a
sequential manner.
 On small database systems, the process of database
design is usually very simple and does not involve a
lot of steps.
 In order to fully appreciate the above diagram, let’s
look at the individual components listed in each step
for overview of design process in DBMS.
Database development life cycle
(DDLC)
A. Requirements analysis

•Planning – This stages of database design


concepts are concerned with planning of
entire Database Development Life Cycle. It
takes into consideration the Information
Systems strategy of the organization.
•System definition – This stage defines the
scope and boundaries of the proposed
database system.
B. Database designing

•Logical model – This stage is concerned


with developing a database model based
on requirements. The entire design is on
paper without any physical
implementations or specific DBMS
considerations.
•Physical model – This stage implements
the logical model of the database taking
into account the DBMS and physical
implementation factors.
C. Implementation

5.Data conversion and loading – this


stage of relational databases design is
concerned with importing and converting
data from the old system into the new
database.
6.Testing – this stage is concerned with the
identification of errors in the newly
implemented system. It checks the
database against requirement
specifications.
Database Engines
 Database Engines

A database engine is a component of


software that facilitates working with
databases.
It controls how information in a database is
saved, retrieved, and altered.
Database engines act as a bridge between
the database's data and the user, facilitating
interaction with the information stored there.
MySQL, Oracle, and SQL Server are just a
few of the most well-known database
management systems.
Importance of Database Engine

◦Data Integrity
◦Scalability
◦Security
◦Performance
◦Ease of Use
DATABASE
ENGINE

Relationa NoSQL Dat Graph data In-Memory Object-or


l Databas abase Engi base engin Database E iented da
e Engine nes es ngines tabase e
s ngines
Database Architecture

A Database Architecture is a representation


of DBMS design. It helps to design, develop,
implement, and maintain the database
management system. A DBMS architecture
allows dividing the database system into
individual components that can be
independently modified, changed, replaced, and
altered. It also helps to understand the
components of a database.
 A Database stores critical information and helps
access data quickly and securely. Therefore,
selecting the correct Architecture of DBMS helps
in easy and efficient data management.
Types of DBMS Architecture

There are mainly three types of


DBMS architecture:
One Tier Architecture (Single Tier
Architecture)
Two Tier Architecture
Three Tier Architecture
1-Tier Architecture

• It is the simplest architecture of Database in


which the client, server, and Database all reside on the
same machine.
• Example: installing a Database in your system
and access it to practice SQL queries. But such
architecture is rarely used in production.
1 Tier Architecture
2-Tier Architecture
• It is a Database architecture where the
presentation layer runs on a client (PC, Mobile, Tablet,
etc.), and data is stored on a server called the second tier.
• Two tier architecture provides added security to
the DBMS as it is not exposed to the end-user directly.
• It also provides direct and faster communication.
2 Tier Architecture

Client 1
Client 3

Database
Client 2
3-Tier Architecture

 It is the most popular client server


architecture in DBMS in which the development
and maintenance of functional processes, logic,
data access, data storage, and user interface is
done independently as separate modules.
 Three Tier architecture contains a
presentation layer, an application layer, and a
database server.
 3-Tier database Architecture design is an
extension of the 2-tier client-server architecture.
A 3-tier architecture has the following layers:
 Presentation layer (your PC, Tablet, Mobile, etc.)
 Application layer (server)
 Database Server
 The Application layer resides between the user and
the DBMS, which is responsible for communicating the
user’s request to the DBMS system and send the
response from the DBMS to the user.
 The application layer(business logic layer) also
processes functional logic, constraint, and rules before
passing data to the user or down to the DBMS.

Goal :
 To separate the user applications and physical database
 To support DBMS characteristics
 Program-data independence
 Supporting multiple views of the data

Example:
 Any large website on the internet
3 Tier Architecture

client server database


 An Architecture of DBMS helps in design, development,
implementation, and maintenance of a database
 The simplest database system architecture is 1 tier where the
Client, Server, and Database all reside on the same machine.
 A two-tier architecture is a database architecture in DBMS
where presentation layer runs on a client and data is stored
on a server.
 Three-tier client-server architecture consists of the
Presentation layer (PC, Tablet, Mobile, etc.), Application layer
(server) and Database Server.
TYPES OF DATABASE
USERS
Different Types
of Database
Users

Application
Programmer
Temporary
or Database
System Users or
End Users Specialized Administrat
Analyst Casual
users or or (DBA)
Users
Back-End
Developer

Naive users /
Parametric
users

Sophisticate
d users
End Users/Parametric
Users −
End Users
Naive Users Sophisticated
• These naive users are those Users
users who don’t have any • These users
database knowledge. interact with the
• They depend on pre- system without
developed applications like writing a program
Bank Management Systems, and have separate
Library Management databases for
Systems, Hospital personal use. In the
Management Systems, and database, the user
Railway Ticket Booking passes each query
Systems(IRCTC) and get theare two ways
There toto
the query with a
interact
desired result. system − processor.
 They use the structure query
language to run the query on the
database.
 They use the tool of data analysis
software. For example, data
engineers and data scientists are
Application programmers/Specialized
programmers/Back-End Developer
 These programmers write the code for an application program that
uses the database.
 The application programmer can make the application according to
user requirements and control software that runs an entire computer
system.
 The application program is written in any programming language like
C#, .net, JAVA, etc., and focuses on business, engineering, and
Application
science program. Programmers
types

Computer
Database Software
Web Developers Hardware
Developers Developers
Programmers

 Examples :
◦ Content access software
◦ Educational Software
◦ Information Worker Software
◦ Media Development Software
◦ Product Engineering Software
System Analyst
A System Analyst has also known as a business
technology analyst.
 These professionals are responsible for the design,
structure, and properties of databases.
 The application programmer uses the specifications
provided by the system analyst to construct the
software that is used by end users.
 The analyst will gather information from the
shareholders as well as end users to understand their
requirements and translate it into functional
specifications for the new system.
 Examples :
◦ They serve as team leaders.
◦ They are responsible for managing projects.
◦ They are the supervisor who manages the lower-level
information Staff.
Database Administrator
(DBA)
 The DBA is the group of people that includes
everything required to manage and solve every
complex.
 The DBA can easily use the database to find the
information they need and to plan the goal of the
database.
 To meet future needs, they are ready for future
scope and provide solutions for end users.
Therefore, they are known for high-level
management.
 Example:
◦ To handle the data loss.
◦ To secure the privacy of data.
◦ Monitor the recovery and backup of the database.
Temporary Users/Casual
Users
These users utilize the database for
testing and are only accessible for a
limited time.
According to business requirements, these
users update a little or new information to
the database with the help of a database
administrator.
It helps to maintain the security and
integrity of data.
Example: High-level management people
are temporary users with little knowledge
of DBMS.
History of Database System (DBMS)
 The first concept of database introduces in the 1960’s. Lots of work has been done in this field.
Following is the brief history of the database System.
 1950’s and early 1960’s
 In 1950s magnetic tape was introduced for storage of data
 The data storage process consists of reading data from many tapes and writing of data to a new
tape. For input, process punched cards used, and for output, the printer was used. For example,
salary raises were processed. In the tapes, storage data read in sequential order. The size of data
much larger than the main memory. Access to the database was through low-level pointer
operations. Storage detail depended on the type of data to be stored. Thus adding an extra field to
your database requires rewriting the underlying access. A user would need to know the physical
structure of the database in order to query for information. One major benefit was the SABRE
system IBM and American Airline.
 1970’s-72’s
 In this year two main relational database system was created, which was developed at UBC, and
system R. E.F Codd proposed the relational model for the database in a landmark paper on how to
think about database. This gave a new concept about the database. He disconnects the schema of
a logical organization of a database from physical storage methods. It was also helpful in the
development of SQL/DS. Two major relational database system prototypes were created between
the years 1974 and 1977, and they were the Ingres, which was developed at UBC, and System R,
created at IBM San Jose. Ingres used a query language known as QUEL, and it led to the creation of
systems such as Ingres Corp., MS SQL Server, Sybase, Wang’s PACE, and Britton-Lee. On the other
hand, System R used the SEQUEL query language, and it contributed to the development of
SQL/DS, Oracle, Non-Stop SQL DB2etc
 1976
 P-Chen introduces a new database model known as ER Entity-Relationship. This design is basically
made to focus on data applications.It gave another important insight into the conceptual data
model. Such a higher level molding allows the designers to focus on the data instead of a logical
structure.
 Early 1980’s
 SQL(Structured Query Language) became standard.IBM launched DB2.the
development of the IBM PC gave rise to many DB companies and products
such as RIM , OS/2, PARADOX, RBASE, Database Management System also
introduce in this period. The relational database system became a success
as rapid increase in computer sales. This increased the popularity of the
network and hierarchical database models.
 Early 1990’s
 In early 1990s much work was done on client tools for application as
development such as PowerBuilder.VB (Microsoft), Oracle Developer. The
client-server model for computing became the norm for future business
decisions. The work on the object database system also started in this year.
The more complex database system was introduced at high prices.in this
year new client tools for application development were introduced. A
number of tools for personal productivity such as ODBC and Excel/Access
were also developed.
 Mid 1990’s
 The usable internet /WWW was introduced in the middle of this year.it
allows remote access to the computer systems. The concept of Web/DB
started to grow. The advancement in the database system was started.
Average desktops users began to use the client-server database.
 Late 1990’s
 In the late 1990s, the online business was increased
resulting in a rise in demand for internet database
connectors like Active server page, Jave Servlets,
FrontPage, Dream Weaver. Enterprise Java Beans, Oracle
Developer 2000 etc.in this year internet companies
worked for Web/Internet connectors. The open-source
solutions came online with online analytic processing
(OLAP) come of age with many merchants using point-
of-sale (POS) technology on a daily basis.
 Early 21st Century
 The growth of DB applications continued in the early
21st century. The more interactive application appeared
with the use of PDAs.The main companies that
predominated the large DB market are IBM.Microsoft
and oracle.
 Today
 Today’s database is used anywhere in our day to day life. In the
present day, there are many new players in the non-relational
database space offering particular solutions. Many powerful
technologies is introduces in the database. The database is very
helpful in every field to keep records save. The quick base is an
online database on a relational database that gives users of any
skill level the ability to create custom applications using the power
of the relational database.
 Future Trends
 The huge system are appearing and the handling and analyzing
data has become very complex. Large database as genome
project, geological, national security and space exploration data
have been developed. Data mining, data warehousing, data marts
are commonly used techniques today. This trend will continue in
the future.XML with java has become a popular technique. Mobiles
database is now coming to the market in various ways. Distributed
transaction processing is also very popular for business planning in
many areas.
Structure of relational database
 Relational databases are the cornerstone of modern data management, playing a pivotal role in storing, organizing, and retrieving vast amounts of information. A relational database management
system (DBMS) employs a well-defined structure that underpins its functionality. In this comprehensive overview, we will delve into the core elements and principles that comprise the structure of
relational databases within a DBMS, shedding light on the key components that enable efficient data storage and manipulation.
 key components of structure of relational database
 Tables
◦ The Foundation of a Relational Database At the core of a relational database are tables, also known as relations. Each table is a two-dimensional structure composed of rows and columns. The columns define the
attributes or properties of the entities represented in the table, while the rows, also called tuples, contain the actual data. For example, consider a database for a library. You might have a “Books” table with columns like
“Title,” “Author,” “ISBN,” and “Publication Year,” and each row represents a specific book in the library.
 Primary Keys
◦ Uniquely Identifying Rows In a relational database, each table should have a primary key, which is a unique identifier for each row. It ensures that no two rows in the table can have the same primary key value, making it
possible to distinguish and access individual records easily. Primary keys can be one or more columns. In the “Books” table, the ISBN column could serve as the primary key, as ISBNs are typically unique to each book.
 Foreign Keys
◦ Establishing Relationships Relational databases excel in managing relationships between tables. This is achieved using foreign keys. A foreign key is a column in one table that refers to the primary key in another table. It
establishes a link between the two tables. In our library database, you might have a “Borrowers” table with a primary key “Library Card Number.” The “Books” table can have a foreign key column, e.g., “Borrower ID,” which
references the “Library Card Number” in the “Borrowers” table. This relationship allows you to associate books with specific borrowers.
 Normalization
◦ Efficient Data Organization Normalization is a process used to organize data in a relational database efficiently. It minimizes data redundancy and ensures data integrity. It involves breaking down tables into smaller,
related tables and using foreign keys to establish relationships. For instance, instead of having all book information in a single “Books” table, you might have separate tables for “Authors,” “Publishers,” and “Genres,” each
linked to the “Books” table through foreign keys. This prevents data duplication and makes it easier to update information consistently.
 SQL
◦ The Language for Database Operations Structured Query Language (SQL) is the standard language used to interact with relational databases. SQL allows you to perform various operations, including data retrieval,
insertion, updating, and deletion. Common SQL commands include SELECT (for querying data), INSERT (for adding new records), UPDATE (for modifying existing data), and DELETE (for removing records). For example, you
can use SQL to retrieve all books authored by a specific author:
 SELECT * FROM Books WHERE Author = 'J.K. Rowling';
 Indexes
◦ Enhancing Query Performance Indexes are data structures that improve the speed of data retrieval operations, especially for large datasets. An index is created on one or more columns in a table, and it allows the DBMS
to quickly locate rows that match a query’s criteria. In our “Books” table, you might create an index on the “Title” column to speed up searches for books by title.
 Transactions
◦ Ensuring Data Consistency A transaction is a sequence of one or more SQL operations that are treated as a single unit of work. They follow the ACID (Atomicity, Consistency, Isolation, Durability) properties, ensuring data
consistency and integrity even in the face of system failures. For instance, when a borrower checks out a book, it involves updating the “Books” table (to mark the book as checked out) and the “Borrowers” table (to record
the transaction). Using transactions ensures that both updates occur together or not at all, preventing inconsistent data.
 Security and Access Control
◦ Relational databases implement security mechanisms to control who can access, modify, and delete data. Access control is typically managed through user accounts and roles. Users are assigned specific privileges that
determine their level of access to the database objects. For instance, a librarian might have full access to the “Books” table, while a regular borrower might only have read access.
 Data Integrity Constraints
◦ Data integrity constraints are rules defined on the data in the database to maintain data accuracy and consistency. Common constraints include primary key constraints (ensuring uniqueness), foreign key constraints
(enforcing referential integrity), and check constraints (verifying data validity). For instance, you can define a check constraint to ensure that the “Publication Year” in the “Books” table must be within a certain range.
 Backup and Recovery
◦ Regular backups of the database are crucial to protect against data loss due to hardware failures, errors, or disasters. Backup strategies include full backups, incremental backups, and transaction log backups. In case of
data corruption or loss, a reliable recovery mechanism
 Advantages
 Structured Data Storage: Organizes data into tables with rows and columns, providing a structured format for efficient data management.
 Data Integrity: Enforces integrity constraints like primary keys and foreign keys to maintain data accuracy and consistency.
 Flexibility in Queries: Supports complex queries and transactions, enabling efficient retrieval, updating, and manipulation of data.
 Security Features: Offers robust security mechanisms such as authentication, access control, and encryption to protect sensitive data.
 Normalization: Reduces redundancy and improves data integrity through normalization techniques, organizing data into logical tables.
 SQL Standardization: Utilizes SQL as a standard interface for querying and managing data, facilitating easier adoption and interoperability.
 Disadvantages
 Scalability Challenges: May encounter limitations in scaling to handle large volumes of data or high transaction loads efficiently.
 Performance Overhead: Complex queries and joins can lead to performance issues, requiring optimization efforts to maintain acceptable performance levels.
 Data Model Rigidity: Changes to data schema can be challenging to implement due to the rigid structure of relational databases.
 Limited Support for Unstructured Data: Not well-suited for storing or querying unstructured data types such as documents or multimedia files.
 Cost: Can be expensive to deploy and maintain, especially for large-scale deployments, due to licensing, hardware, and maintenance costs.
 Concurrency Control Complexity: Managing concurrent access to data may require complex locking mechanisms, impacting system performance and scalability.
What is a Key?
 When we are working with databases, we store data in tables. Tables
are a collection of the same type of record. A table has columns.
 A “key” is a field in a table that is used in the identification of
that record.
 That seems pretty broad, but that’s because there are different types
of keys.
 I mentioned a few of them earlier, so we’ll explain each of them and
what they are used for.
 Why should you know about the different types of keys?
 First, it helps you communicate with others better. In software
development, there are a range of terms that we have invented or
implemented to describe how something works. This makes it easier
to communicate. Developers use the word “inheritance” instead of
“make this object a sub-type of that object”. The same can be said for
the different types of keys.
 Secondly, it will help you consider new ways of designing your
database, especially when deciding on what your primary key would
be. This will make more sense as we look at the different types of
keys.
Different Types of Keys

In relational databases, there are


several different types of keys:
Primary key
Natural key
Surrogate key
Composite key
Alternate key
Unique key
Foreign key

You might also like