SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
1 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
CHAPTER I
Introduction to Databases and Transactions: What is database system, purpose of database
system, view of data, relational databases, database architecture, transaction management
What is Data?
It is defined as “facts related to any object “. Data is organized into rows, columns and tables, and
it is indexed to make it easier to find relevant information
for eg : data of customer i.e cust_name, cust_no, cust_address .
What is Database?
It is defined as “ systematic way to collect data”.
Database is a collection of inter-related data which helps in efficient retrieval, insertion and
deletion of data from database and organizes the data in the form of tables, views, schemas, reports
etc”.
For example, university database organizes the data about students, faculty, and admin staff etc.
which helps in efficient retrieval, insertion and deletion of data from it. for eg : Customer database.
What is DBMS?
Database-management system (DBMS) is a computer-software application that consist of set of
programs which interacts with end-users, other applications, and the database itself to capture and
analyze data.
Following are steps performed while creating database using DBMS software:
▪ Creation of a database.
▪ Retrieval of information from the database.
▪ Updating the database.
▪ Managing a database.
Hence we can say DBMS is “Computerized record keeping system”. A general-purpose DBMS
allows the definition, creation, querying, update, and administration of databases for eg : SQL
Server by Microsoft , DB2 by IBM , Oracle .
The DBMS manages 3 aspects :
1)Physical Database : it contains collection of files that contains data .
2)Database Engine: that allows data to be accessed, locked and modified .
3)Database Schema, which defines the database’s logical structure.
2 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
Thus we can conclude that “Database Management System (DBMS) is a complex set of software
programs that controls the organization, storage, management, and retrieval of data in a database”.
DBMS are categorized according to their data structures or types.
Different Database Languages (DDL,DML, DCL,TCL ,DQL)
✓ DDL (Data Definition Language): Used for creating and altering
(CREATE,ALTER,DROP,RENAME/REPLACE,TRUNCATE)
✓ DML(Data Manipulation Language):Used for adding and modifying data
✓ (INSERT, UPDATE, DELETE)
✓ DCL(Data Control Language):Used for controlling access of database(user rights)
✓ (GRANT, REVOKE)
✓ TCL(Transaction Control Language):Used for .completing transaction with ACID
property (ROLLBACK,COMMIT,SAVEPOINT).
✓ DQL (Data Query Language): Used for querying database.
Following are some disadvantages of using Traditional Methods (File System) over DBMS
✓ Redundancy of data: Data is said to be redundant if same data is copied at many places.
✓ Inconsistency of Data: Data is said to be inconsistent if multiple copies of same data does
not match with each other.
✓ Difficult Data Access: A user should know the exact location of file to access data, so the
process is very cumbersome and tedious.
✓ Unauthorized: File System may lead to unauthorized access to data.
✓ No Concurrent Access: The access of same data by multiple users at same time is known
as concurrency. File system does not allow concurrency as data can be accessed by only
one user at a time.
✓ No Backup and Recovery: File system does not incorporate any backup and recovery of
data if a file is lost or corrupted.
3 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
What is Purpose of Database System?
Now a day’s data have become an integral part of information systems for decision making and
managing data. Thus we can say that “Data is resource for finding hidden facts and identifying
relationships between them”. Following are some benefits and purpose of using database system.
1. Database system enables us to store and retrieve database information that is both
convenient and efficient.
2. Databases are designed to manage simple and complex queries.
3. Data Consolidation.
4. Data can be shared across multiple users.
5. Enforces i) Data Integrity ii) Data Security iii) Eliminate data redundancy iv) Provides
backup and recovery v) Provides solutions to concurrency and inconsistency issue.
6. Centralized access and control of data.
7. Provides data scalability, expandability and flexibility.
8. Standards can be enforced (Constraints – primary and foreign key)
9. Data Independence
10. Safety against system failures or attempts at the times of unauthorized access.
Explain Application Area of Database Systems.
▪ Railway Reservation System: Database is required to keep record of ticket booking, train’s
departure and arrival status. Also if trains get late then people get to know it through
database update.
4 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
▪ Banking: We make thousands of transactions through banks daily and we can do this
without going to the bank. So how banking has become so easy that by sitting at home we
can send or get money through banks. That is all possible just because of DBMS that
manages all the bank transactions.
▪ Universities and colleges: Examinations are done online today and universities and
colleges maintain all these records through DBMS. Student’s registrations details, results,
courses and grades all the information is stored in database.
▪ Social Media Sites: We all are on social media websites to share our views and connect
with our friends. Daily millions of users signed up for these social media accounts like face
book, twitter, interest and Google plus. But how all the information of users are stored and
how we become able to connect to other people, yes this all because DBMS.
▪ Online Shopping: Online shopping has become a big trend of these days. No one wants to
go to shops and waste his time. Everyone wants to shop from home. So all these products
are added and sold only with the help of DBMS. Purchase information, invoice bills and
payment, all of these are done with the help of DBMS.
▪ Manufacturing: Manufacturing companies make products and sales them on the daily basis.
To keep records of all the details about the products like quantity, bills, purchase, supply
chain management, DBMS is used.
▪ Telecom: There is a database to keeps track of the information regarding calls made,
network usage, customer details etc. Without the database systems it is hard to maintain
that huge amount of data that keeps updating every millisecond.
Explain View of Data/Levels of Abstraction/Degree of Abstraction.
It is also known as 3-tier architecture and used for database design. It separates its tiers from each
other based on complexity of users and how they use data present in database.
Following are the three levels of database abstraction.
1. Physical Level
2. Logical/Conceptual Level
3. External/View Level
5 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
In the above diagram - It shows the architecture of DBMS. Mapping is the process of
transforming request response between various database levels of architecture. Mapping is not
good for small database, because it takes more time. In External / Conceptual mapping, DBMS
transforms a request on an external schema against the conceptual schema. In Conceptual / Internal
mapping, it is necessary to transform the request from the conceptual to internal levels.
1. Physical Level : Physical level describes the physical storage structure of data in database.
It is also known as Internal Level. This level is very close to physical storage of data.
At lowest level, it is stored in the form of bits with the physical addresses on the secondary storage
device. At highest level, it can be viewed in the form of files. The internal schema defines the
various stored data types. It uses a physical data model.
2. Conceptual Level: Conceptual level describes the structure of the whole database for a group
of users It is also called as the data model. Conceptual schema is a representation of the entire
content of the database. This schema contains all the information to build relevant external records.
It hides the internal details of physical storage.
3. External Level: External level is related to the data which is viewed by individual end users.
This level includes a no. of user views or external schemas. This level is closest to the user.
External view describes the segment of the database that is required for a particular user group and
hides the rest of the database from that user group.
Thus we can conclude that:
Physical schema
Defines how data is stored
Conceptual schema or logical schema
Defines data in terms of a data model
External schema or view level
Defines a number of simplified domain-specific views
6 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
View level Logical level Physical level
Highest level abstraction Middle level Lowest level
Describe only specific part of
database
Describes what data is stored
and what are their relationships
Describes how data actually
stored
At this level we have
application programs which are
accessed by user according to
data required
Programmer works at this level This level is kept hidden by
compiler from programme
There are many different views
of some data
Data administrator use this
level of abstraction to decide
what information to keep in a
data base
At this level the records can be
described as block of storage
(bytes, TB, GB)
What is Relational Database?
▪ A relational database is a database purely based on the logical structure of data, as
proposed by E. F. Codd in 1970. A software system used to maintain relational databases
is a relational database management system (RDBMS).
▪ Each table in a relational database contains rows (records) and columns (fields).
In computer science terminology, rows are sometimes called "tuples," columns may be
referred to as "attributes," and the tables themselves may be called "relations."
▪ A table can be visualized as a matrix of rows and columns, where each intersection of a
row and column contains a specific value. It is "relational" since all records share the same
fields.
7 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
Advantages:
1. Uses OOPs (Object Oriented Programming)concept
2. Secured
3. Multiple users can access data which is not possible in simple DBMS .
4. Avoids data redundancy problems using NORMAL FORMS.
5. It performs all DML operations
6. Supports data independence
Disadvantages:
1. Inability to handle spatial databases
2. No support for complex objects like documents ,images, video
3. Cannot manage interrelated relationships of data.
Codd 12 Rules
Dr Edgar F. Codd, after his extensive research on the Relational Model of database systems, came
up with twelve rules of his own, which according to him, a database must obey in order to be
regarded as a true relational database. These rules can be applied on any database system that
manages stored data using only its relational capabilities. This is a foundation rule, which acts as
a base for all the other rules.
Rule 1: Information Rule: The data stored in a database, may it be user data or metadata, must be
a value of some table cell. Everything in a database must be stored in a table format.
Rule 2: Guaranteed Access Rule: Every single data element (value) is guaranteed to be accessible
logically with a combination of table-name, primary-key (row value), and attribute-name (column
value). No other means, such as pointers, can be used to access data.
8 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
Rule 3: Systematic Treatment of NULL Values: The NULL values in a database must be given a
systematic and uniform treatment. This is a very important rule because a NULL can be interpreted
as one the following − data is missing, data is not known, or data is not applicable.
Rule 4: Active Online Catalog: The structure description of the entire database must be stored in
an online catalog, known as data dictionary, which can be accessed by authorized users. Users
can use the same query language to access the catalog which they use to access the database itself.
Rule 5: Comprehensive Data Sub-Language Rule: A database can only be accessed using a
language having linear syntax that supports data definition, data manipulation, and transaction
management operations. This language can be used directly or by means of some application. If
the database allows access to data without any help of this language, then it is considered as a
violation.
Rule 6: View Updating Rule: All the views of a database, which can theoretically be updated, must
also be updatable by the system.
Rule 7: High-Level Insert, Update, and Delete Rule : A database must support high-level insertion,
updation, and deletion. This must not be limited to a single row, that is, it must also support union,
intersection and minus operations to yield sets of data records.
Rule 8: Physical Data Independence: The data stored in a database must be independent of the
applications that access the database. Any change in the physical structure of a database must not
have any impact on how the data is being accessed by external applications.
Rule 9: Logical Data Independence: The logical data in a database must be independent of its
user’s view (application). Any change in logical data must not affect the applications using it. For
example, if two tables are merged or one is split into two different tables, there should be no impact
or change on the user application. This is one of the most difficult rules to apply.
Rule 10: Integrity Independence: A database must be independent of the application that uses it.
All its integrity constraints can be independently modified without the need of any change in the
application. This rule makes a database independent of the front-end application and its interface.
Rule 11: Distribution Independence: The end-user must not be able to see that the data is
distributed over various locations. Users should always get the impression that the data is located
at one site only. This rule has been regarded as the foundation of distributed database systems.
Rule 12: Non-Subversion Rule: If a system has an interface that provides access to low-level
records, then the interface must not be able to subvert the system and bypass security and integrity
constraints
Explain Database Architectures
▪ The design of a DBMS depends on its architecture. It can be centralized or decentralized or
hierarchical. The architecture of a DBMS can be seen as either single tier or multi-tier. N-tier
architecture divides the whole system into related but independent n modules, which can be
independently modified, altered, changed, or replaced.
▪ In 1-tier architecture, the DBMS is the only entity where the user directly sits on the DBMS
and uses it. Any changes done here will directly be done on the DBMS itself. It does not
9 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
provide handy tools for end-users. Database designers and programmers normally prefer to use
single-tier architecture.
▪ If the architecture of DBMS is 2-tier, then it must have an application through which the DBMS
can be accessed. Programmers use 2-tier architecture where they access the DBMS by means
of an application. Here the application tier is entirely independent of the database in terms of
operation, design, and programming.
▪ 3-tier Architecture separates its tiers from each other based on the complexity of the users and
how they use the data present in the database. It is the most widely used architecture to design
a DBMS.
▪ Database (Data)Bottom Tier − At this tier, the database resides along with its query
processing languages. We also have the relations that define the data and their constraints at
this level.
▪ Application /Logic (Middle) Tier − At this tier reside the application server and the programs
that access the database. For a user, this application tier presents an abstracted view of the
database. End-users are unaware of any existence of the database beyond the application. At
the other end, the database tier is not aware of any other user beyond the application tier. Hence,
the application layer sits in the middle and acts as a mediator between the end-user and the
database.
▪ Client(Presentation) Top Tier− End-users operate on this tier and they know nothing about
any existence of the database beyond this layer. At this layer, multiple views of the database
can be provided by the application. All views are generated by applications that reside in the
application tier.
▪ Multiple-tier database architecture is highly modifiable, as almost all its components are
independent and can be changed independently.
10 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
1.6- Transaction Management:
▪ A transaction can be defined as a group of tasks. A single task is the minimum processing
unit which cannot be divided further. A transaction is a collection of operations that
performs a single logical function in a database application.
For example, you are transferring money from your bank account to your friend’s account, the
set of operations would be like this:
▪ Transaction steps :
1. Read your account balance
2. Deduct the amount from your balance
3. Write the remaining balance to your account
4. Read your friend’s account balance
5. Add the amount to his account balance
6. Write the new updated balance to his account
▪ This whole set of operations can be called a transaction. Transaction can have operations like
read, write, insert, update, delete.
Transaction failure in between the operations
▪ The main problem that can happen during a transaction is that the transaction can fail before
finishing the all the operations in the set. This can happen due to power failure, system crash
etc. This is a serious problem that can leave database in an inconsistent state. Assume that
transaction fail after third operation (example above) then the amount would be deducted from
your account but your friend will not receive it. To solve this problem, we have the following
two operations
11 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
▪ Commit: If all the operations in a transaction are completed successfully then commit
those changes to the database permanently.
▪ Rollback: If any of the operation fails then rollback all the changes done by previous
operations.
▪ To ensure the integrity of data during a transaction. The database system maintains the
following properties. These properties are known as ACID properties:
1. Atomicity − This property states that a transaction must be treated as an atomic unit,
that is, either all of its operations are executed or none. There must be no state in a
database where a transaction is left partially completed. States should be defined either
before the execution of the transaction or after the execution/abortion/failure of the
transaction.
2. Consistency − The database must remain in a consistent state after any transaction. No
transaction should have any adverse effect on the data residing in the database. If the
database was in a consistent state before the execution of a transaction, it must remain
consistent after the execution of the transaction as well.
3. Durability − The database should be durable enough to hold all its latest updates even
if the system fails or restarts. If a transaction updates a chunk of data in a database and
commits, then the database will hold the modified data. If a transaction commits but
the system fails before the data could be written on to the disk, then that data will be
updated once the system springs back into action.
4. Isolation − In a database system where more than one transaction are being executed
simultaneously and in parallel, the property of isolation states that all the transactions
will be carried out and executed as if it is the only transaction in the system. No
transaction will affect the existence of any other transaction.
States of Transaction : A transaction in a database can be in one of the following states
12 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S
▪ Active − In this state, the transaction is being executed. This is the initial state of every
transaction.
▪ Partially Committed − When a transaction executes its final operation, it is said to be in
a partially committed state.
▪ Failed − A transaction is said to be in a failed state if any of the checks made by the
database recovery system fails. A failed transaction can no longer proceed further.
▪ Aborted − If any of the checks fails and the transaction has reached a failed state, then the
recovery manager rolls back all its write operations on the database to bring the database
back to its original state where it was prior to the execution of the transaction. Transactions
in this state are called aborted. The database recovery module can select one of the two
operations after a transaction aborts −Re-start the transaction, Kill the transaction
▪ Committed − If a transaction executes all its operations successfully, it is said to be
committed. All its effects are now permanently established on the database system.

Más contenido relacionado

La actualidad más candente

Architecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceArchitecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independence
Anuj Modi
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
koolkampus
 
SSAD; TOOLS & TECHNIQUES
SSAD; TOOLS & TECHNIQUESSSAD; TOOLS & TECHNIQUES
SSAD; TOOLS & TECHNIQUES
Malvika Bansal
 

La actualidad más candente (20)

Database abstraction
Database abstractionDatabase abstraction
Database abstraction
 
Difference between File system And DBMS.pptx
Difference between File system And DBMS.pptxDifference between File system And DBMS.pptx
Difference between File system And DBMS.pptx
 
SQL - Structured query language introduction
SQL - Structured query language introductionSQL - Structured query language introduction
SQL - Structured query language introduction
 
Software Engineering- ERD DFD Decision Tree and Table
Software Engineering- ERD DFD Decision Tree and TableSoftware Engineering- ERD DFD Decision Tree and Table
Software Engineering- ERD DFD Decision Tree and Table
 
Dms 22319 micro project
Dms 22319 micro projectDms 22319 micro project
Dms 22319 micro project
 
Architecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceArchitecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independence
 
Lesson 1: Introduction to DBMS
Lesson 1: Introduction to DBMSLesson 1: Introduction to DBMS
Lesson 1: Introduction to DBMS
 
Presentation on Database management system
Presentation on Database management systemPresentation on Database management system
Presentation on Database management system
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
 
Chapter8 pl sql
Chapter8 pl sqlChapter8 pl sql
Chapter8 pl sql
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)
 
SSAD; TOOLS & TECHNIQUES
SSAD; TOOLS & TECHNIQUESSSAD; TOOLS & TECHNIQUES
SSAD; TOOLS & TECHNIQUES
 
Basic DBMS ppt
Basic DBMS pptBasic DBMS ppt
Basic DBMS ppt
 
Bank Management System
Bank Management SystemBank Management System
Bank Management System
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
 
Introduction: Databases and Database Users
Introduction: Databases and Database UsersIntroduction: Databases and Database Users
Introduction: Databases and Database Users
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Dbms ppt
Dbms pptDbms ppt
Dbms ppt
 
Sql commands
Sql commandsSql commands
Sql commands
 
DBTG MODEL
DBTG MODELDBTG MODEL
DBTG MODEL
 

Similar a Introduction to Databases and Transactions

DBMS-material for b.tech students to learn
DBMS-material for b.tech students to learnDBMS-material for b.tech students to learn
DBMS-material for b.tech students to learn
Rajasekhar364622
 
CP 121_2.pptx about time to be implement
CP 121_2.pptx about time to be implementCP 121_2.pptx about time to be implement
CP 121_2.pptx about time to be implement
flyinimohamed
 

Similar a Introduction to Databases and Transactions (20)

Unit3rd
Unit3rdUnit3rd
Unit3rd
 
Database Management System.pptx
Database Management System.pptxDatabase Management System.pptx
Database Management System.pptx
 
DBMS-material for b.tech students to learn
DBMS-material for b.tech students to learnDBMS-material for b.tech students to learn
DBMS-material for b.tech students to learn
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
Database, Lecture-1.ppt
Database, Lecture-1.pptDatabase, Lecture-1.ppt
Database, Lecture-1.ppt
 
Dbms Useful PPT
Dbms Useful PPTDbms Useful PPT
Dbms Useful PPT
 
Ch01
Ch01Ch01
Ch01
 
Dbms notes
Dbms notesDbms notes
Dbms notes
 
01-database-management.pptx
01-database-management.pptx01-database-management.pptx
01-database-management.pptx
 
Unit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptxUnit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptx
 
CP 121_2.pptx about time to be implement
CP 121_2.pptx about time to be implementCP 121_2.pptx about time to be implement
CP 121_2.pptx about time to be implement
 
MS-CIT Unit 9.pptx
MS-CIT Unit 9.pptxMS-CIT Unit 9.pptx
MS-CIT Unit 9.pptx
 
DBMS-1.pptx
DBMS-1.pptxDBMS-1.pptx
DBMS-1.pptx
 
DBMS NOTES.pdf
DBMS  NOTES.pdfDBMS  NOTES.pdf
DBMS NOTES.pdf
 
Unit1 DBMS Introduction
Unit1 DBMS IntroductionUnit1 DBMS Introduction
Unit1 DBMS Introduction
 
Database Management System ( Dbms )
Database Management System ( Dbms )Database Management System ( Dbms )
Database Management System ( Dbms )
 
Relational database management systems
Relational database management systemsRelational database management systems
Relational database management systems
 
Clifford Sugerman
Clifford SugermanClifford Sugerman
Clifford Sugerman
 
Clifford sugerman
Clifford sugermanClifford sugerman
Clifford sugerman
 
23246406 dbms-unit-1
23246406 dbms-unit-123246406 dbms-unit-1
23246406 dbms-unit-1
 

Último

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Último (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

Introduction to Databases and Transactions

  • 1. 1 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S CHAPTER I Introduction to Databases and Transactions: What is database system, purpose of database system, view of data, relational databases, database architecture, transaction management What is Data? It is defined as “facts related to any object “. Data is organized into rows, columns and tables, and it is indexed to make it easier to find relevant information for eg : data of customer i.e cust_name, cust_no, cust_address . What is Database? It is defined as “ systematic way to collect data”. Database is a collection of inter-related data which helps in efficient retrieval, insertion and deletion of data from database and organizes the data in the form of tables, views, schemas, reports etc”. For example, university database organizes the data about students, faculty, and admin staff etc. which helps in efficient retrieval, insertion and deletion of data from it. for eg : Customer database. What is DBMS? Database-management system (DBMS) is a computer-software application that consist of set of programs which interacts with end-users, other applications, and the database itself to capture and analyze data. Following are steps performed while creating database using DBMS software: ▪ Creation of a database. ▪ Retrieval of information from the database. ▪ Updating the database. ▪ Managing a database. Hence we can say DBMS is “Computerized record keeping system”. A general-purpose DBMS allows the definition, creation, querying, update, and administration of databases for eg : SQL Server by Microsoft , DB2 by IBM , Oracle . The DBMS manages 3 aspects : 1)Physical Database : it contains collection of files that contains data . 2)Database Engine: that allows data to be accessed, locked and modified . 3)Database Schema, which defines the database’s logical structure.
  • 2. 2 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S Thus we can conclude that “Database Management System (DBMS) is a complex set of software programs that controls the organization, storage, management, and retrieval of data in a database”. DBMS are categorized according to their data structures or types. Different Database Languages (DDL,DML, DCL,TCL ,DQL) ✓ DDL (Data Definition Language): Used for creating and altering (CREATE,ALTER,DROP,RENAME/REPLACE,TRUNCATE) ✓ DML(Data Manipulation Language):Used for adding and modifying data ✓ (INSERT, UPDATE, DELETE) ✓ DCL(Data Control Language):Used for controlling access of database(user rights) ✓ (GRANT, REVOKE) ✓ TCL(Transaction Control Language):Used for .completing transaction with ACID property (ROLLBACK,COMMIT,SAVEPOINT). ✓ DQL (Data Query Language): Used for querying database. Following are some disadvantages of using Traditional Methods (File System) over DBMS ✓ Redundancy of data: Data is said to be redundant if same data is copied at many places. ✓ Inconsistency of Data: Data is said to be inconsistent if multiple copies of same data does not match with each other. ✓ Difficult Data Access: A user should know the exact location of file to access data, so the process is very cumbersome and tedious. ✓ Unauthorized: File System may lead to unauthorized access to data. ✓ No Concurrent Access: The access of same data by multiple users at same time is known as concurrency. File system does not allow concurrency as data can be accessed by only one user at a time. ✓ No Backup and Recovery: File system does not incorporate any backup and recovery of data if a file is lost or corrupted.
  • 3. 3 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S What is Purpose of Database System? Now a day’s data have become an integral part of information systems for decision making and managing data. Thus we can say that “Data is resource for finding hidden facts and identifying relationships between them”. Following are some benefits and purpose of using database system. 1. Database system enables us to store and retrieve database information that is both convenient and efficient. 2. Databases are designed to manage simple and complex queries. 3. Data Consolidation. 4. Data can be shared across multiple users. 5. Enforces i) Data Integrity ii) Data Security iii) Eliminate data redundancy iv) Provides backup and recovery v) Provides solutions to concurrency and inconsistency issue. 6. Centralized access and control of data. 7. Provides data scalability, expandability and flexibility. 8. Standards can be enforced (Constraints – primary and foreign key) 9. Data Independence 10. Safety against system failures or attempts at the times of unauthorized access. Explain Application Area of Database Systems. ▪ Railway Reservation System: Database is required to keep record of ticket booking, train’s departure and arrival status. Also if trains get late then people get to know it through database update.
  • 4. 4 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S ▪ Banking: We make thousands of transactions through banks daily and we can do this without going to the bank. So how banking has become so easy that by sitting at home we can send or get money through banks. That is all possible just because of DBMS that manages all the bank transactions. ▪ Universities and colleges: Examinations are done online today and universities and colleges maintain all these records through DBMS. Student’s registrations details, results, courses and grades all the information is stored in database. ▪ Social Media Sites: We all are on social media websites to share our views and connect with our friends. Daily millions of users signed up for these social media accounts like face book, twitter, interest and Google plus. But how all the information of users are stored and how we become able to connect to other people, yes this all because DBMS. ▪ Online Shopping: Online shopping has become a big trend of these days. No one wants to go to shops and waste his time. Everyone wants to shop from home. So all these products are added and sold only with the help of DBMS. Purchase information, invoice bills and payment, all of these are done with the help of DBMS. ▪ Manufacturing: Manufacturing companies make products and sales them on the daily basis. To keep records of all the details about the products like quantity, bills, purchase, supply chain management, DBMS is used. ▪ Telecom: There is a database to keeps track of the information regarding calls made, network usage, customer details etc. Without the database systems it is hard to maintain that huge amount of data that keeps updating every millisecond. Explain View of Data/Levels of Abstraction/Degree of Abstraction. It is also known as 3-tier architecture and used for database design. It separates its tiers from each other based on complexity of users and how they use data present in database. Following are the three levels of database abstraction. 1. Physical Level 2. Logical/Conceptual Level 3. External/View Level
  • 5. 5 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S In the above diagram - It shows the architecture of DBMS. Mapping is the process of transforming request response between various database levels of architecture. Mapping is not good for small database, because it takes more time. In External / Conceptual mapping, DBMS transforms a request on an external schema against the conceptual schema. In Conceptual / Internal mapping, it is necessary to transform the request from the conceptual to internal levels. 1. Physical Level : Physical level describes the physical storage structure of data in database. It is also known as Internal Level. This level is very close to physical storage of data. At lowest level, it is stored in the form of bits with the physical addresses on the secondary storage device. At highest level, it can be viewed in the form of files. The internal schema defines the various stored data types. It uses a physical data model. 2. Conceptual Level: Conceptual level describes the structure of the whole database for a group of users It is also called as the data model. Conceptual schema is a representation of the entire content of the database. This schema contains all the information to build relevant external records. It hides the internal details of physical storage. 3. External Level: External level is related to the data which is viewed by individual end users. This level includes a no. of user views or external schemas. This level is closest to the user. External view describes the segment of the database that is required for a particular user group and hides the rest of the database from that user group. Thus we can conclude that: Physical schema Defines how data is stored Conceptual schema or logical schema Defines data in terms of a data model External schema or view level Defines a number of simplified domain-specific views
  • 6. 6 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S View level Logical level Physical level Highest level abstraction Middle level Lowest level Describe only specific part of database Describes what data is stored and what are their relationships Describes how data actually stored At this level we have application programs which are accessed by user according to data required Programmer works at this level This level is kept hidden by compiler from programme There are many different views of some data Data administrator use this level of abstraction to decide what information to keep in a data base At this level the records can be described as block of storage (bytes, TB, GB) What is Relational Database? ▪ A relational database is a database purely based on the logical structure of data, as proposed by E. F. Codd in 1970. A software system used to maintain relational databases is a relational database management system (RDBMS). ▪ Each table in a relational database contains rows (records) and columns (fields). In computer science terminology, rows are sometimes called "tuples," columns may be referred to as "attributes," and the tables themselves may be called "relations." ▪ A table can be visualized as a matrix of rows and columns, where each intersection of a row and column contains a specific value. It is "relational" since all records share the same fields.
  • 7. 7 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S Advantages: 1. Uses OOPs (Object Oriented Programming)concept 2. Secured 3. Multiple users can access data which is not possible in simple DBMS . 4. Avoids data redundancy problems using NORMAL FORMS. 5. It performs all DML operations 6. Supports data independence Disadvantages: 1. Inability to handle spatial databases 2. No support for complex objects like documents ,images, video 3. Cannot manage interrelated relationships of data. Codd 12 Rules Dr Edgar F. Codd, after his extensive research on the Relational Model of database systems, came up with twelve rules of his own, which according to him, a database must obey in order to be regarded as a true relational database. These rules can be applied on any database system that manages stored data using only its relational capabilities. This is a foundation rule, which acts as a base for all the other rules. Rule 1: Information Rule: The data stored in a database, may it be user data or metadata, must be a value of some table cell. Everything in a database must be stored in a table format. Rule 2: Guaranteed Access Rule: Every single data element (value) is guaranteed to be accessible logically with a combination of table-name, primary-key (row value), and attribute-name (column value). No other means, such as pointers, can be used to access data.
  • 8. 8 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S Rule 3: Systematic Treatment of NULL Values: The NULL values in a database must be given a systematic and uniform treatment. This is a very important rule because a NULL can be interpreted as one the following − data is missing, data is not known, or data is not applicable. Rule 4: Active Online Catalog: The structure description of the entire database must be stored in an online catalog, known as data dictionary, which can be accessed by authorized users. Users can use the same query language to access the catalog which they use to access the database itself. Rule 5: Comprehensive Data Sub-Language Rule: A database can only be accessed using a language having linear syntax that supports data definition, data manipulation, and transaction management operations. This language can be used directly or by means of some application. If the database allows access to data without any help of this language, then it is considered as a violation. Rule 6: View Updating Rule: All the views of a database, which can theoretically be updated, must also be updatable by the system. Rule 7: High-Level Insert, Update, and Delete Rule : A database must support high-level insertion, updation, and deletion. This must not be limited to a single row, that is, it must also support union, intersection and minus operations to yield sets of data records. Rule 8: Physical Data Independence: The data stored in a database must be independent of the applications that access the database. Any change in the physical structure of a database must not have any impact on how the data is being accessed by external applications. Rule 9: Logical Data Independence: The logical data in a database must be independent of its user’s view (application). Any change in logical data must not affect the applications using it. For example, if two tables are merged or one is split into two different tables, there should be no impact or change on the user application. This is one of the most difficult rules to apply. Rule 10: Integrity Independence: A database must be independent of the application that uses it. All its integrity constraints can be independently modified without the need of any change in the application. This rule makes a database independent of the front-end application and its interface. Rule 11: Distribution Independence: The end-user must not be able to see that the data is distributed over various locations. Users should always get the impression that the data is located at one site only. This rule has been regarded as the foundation of distributed database systems. Rule 12: Non-Subversion Rule: If a system has an interface that provides access to low-level records, then the interface must not be able to subvert the system and bypass security and integrity constraints Explain Database Architectures ▪ The design of a DBMS depends on its architecture. It can be centralized or decentralized or hierarchical. The architecture of a DBMS can be seen as either single tier or multi-tier. N-tier architecture divides the whole system into related but independent n modules, which can be independently modified, altered, changed, or replaced. ▪ In 1-tier architecture, the DBMS is the only entity where the user directly sits on the DBMS and uses it. Any changes done here will directly be done on the DBMS itself. It does not
  • 9. 9 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S provide handy tools for end-users. Database designers and programmers normally prefer to use single-tier architecture. ▪ If the architecture of DBMS is 2-tier, then it must have an application through which the DBMS can be accessed. Programmers use 2-tier architecture where they access the DBMS by means of an application. Here the application tier is entirely independent of the database in terms of operation, design, and programming. ▪ 3-tier Architecture separates its tiers from each other based on the complexity of the users and how they use the data present in the database. It is the most widely used architecture to design a DBMS. ▪ Database (Data)Bottom Tier − At this tier, the database resides along with its query processing languages. We also have the relations that define the data and their constraints at this level. ▪ Application /Logic (Middle) Tier − At this tier reside the application server and the programs that access the database. For a user, this application tier presents an abstracted view of the database. End-users are unaware of any existence of the database beyond the application. At the other end, the database tier is not aware of any other user beyond the application tier. Hence, the application layer sits in the middle and acts as a mediator between the end-user and the database. ▪ Client(Presentation) Top Tier− End-users operate on this tier and they know nothing about any existence of the database beyond this layer. At this layer, multiple views of the database can be provided by the application. All views are generated by applications that reside in the application tier. ▪ Multiple-tier database architecture is highly modifiable, as almost all its components are independent and can be changed independently.
  • 10. 10 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S 1.6- Transaction Management: ▪ A transaction can be defined as a group of tasks. A single task is the minimum processing unit which cannot be divided further. A transaction is a collection of operations that performs a single logical function in a database application. For example, you are transferring money from your bank account to your friend’s account, the set of operations would be like this: ▪ Transaction steps : 1. Read your account balance 2. Deduct the amount from your balance 3. Write the remaining balance to your account 4. Read your friend’s account balance 5. Add the amount to his account balance 6. Write the new updated balance to his account ▪ This whole set of operations can be called a transaction. Transaction can have operations like read, write, insert, update, delete. Transaction failure in between the operations ▪ The main problem that can happen during a transaction is that the transaction can fail before finishing the all the operations in the set. This can happen due to power failure, system crash etc. This is a serious problem that can leave database in an inconsistent state. Assume that transaction fail after third operation (example above) then the amount would be deducted from your account but your friend will not receive it. To solve this problem, we have the following two operations
  • 11. 11 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S ▪ Commit: If all the operations in a transaction are completed successfully then commit those changes to the database permanently. ▪ Rollback: If any of the operation fails then rollback all the changes done by previous operations. ▪ To ensure the integrity of data during a transaction. The database system maintains the following properties. These properties are known as ACID properties: 1. Atomicity − This property states that a transaction must be treated as an atomic unit, that is, either all of its operations are executed or none. There must be no state in a database where a transaction is left partially completed. States should be defined either before the execution of the transaction or after the execution/abortion/failure of the transaction. 2. Consistency − The database must remain in a consistent state after any transaction. No transaction should have any adverse effect on the data residing in the database. If the database was in a consistent state before the execution of a transaction, it must remain consistent after the execution of the transaction as well. 3. Durability − The database should be durable enough to hold all its latest updates even if the system fails or restarts. If a transaction updates a chunk of data in a database and commits, then the database will hold the modified data. If a transaction commits but the system fails before the data could be written on to the disk, then that data will be updated once the system springs back into action. 4. Isolation − In a database system where more than one transaction are being executed simultaneously and in parallel, the property of isolation states that all the transactions will be carried out and executed as if it is the only transaction in the system. No transaction will affect the existence of any other transaction. States of Transaction : A transaction in a database can be in one of the following states
  • 12. 12 | P a g e S Y B S c I T – S E M I I I - I n t r o d u c t i o n t o D B M S ▪ Active − In this state, the transaction is being executed. This is the initial state of every transaction. ▪ Partially Committed − When a transaction executes its final operation, it is said to be in a partially committed state. ▪ Failed − A transaction is said to be in a failed state if any of the checks made by the database recovery system fails. A failed transaction can no longer proceed further. ▪ Aborted − If any of the checks fails and the transaction has reached a failed state, then the recovery manager rolls back all its write operations on the database to bring the database back to its original state where it was prior to the execution of the transaction. Transactions in this state are called aborted. The database recovery module can select one of the two operations after a transaction aborts −Re-start the transaction, Kill the transaction ▪ Committed − If a transaction executes all its operations successfully, it is said to be committed. All its effects are now permanently established on the database system.