Professional Documents
Culture Documents
Unit 1
Unit 1
Unit 1
Example:
Features :
Security of Data
Durability of Data( ability to withstand)
Isolation of Data(privacy)
Consistency of Data(stable)
Reliability of Data(performs consistently without causing
problems)
Applications
Banking
Universities
Reservation Systems
Telecommunication
Online Shopping
Purpose of Database System
Data Abstraction
Data abstraction is hiding the complex data structure in order
to simplify the user’s interface of the system.
Hiding irrelevant details from user and providing abstract view of
data to users, helps in easy and efficient user-database interaction
To achieve data abstraction, use Three-Schema architecture which
abstracts the database at three levels.
Three-Schema Architecture:
The main objective -> separation between the user interface and
the physical database.
Logical level:
what data is stored in database and what relationships exist
among those data
View level:
data is stored in the form of the entity set, entities, their data types,
the relationship among the entity sets, user operations performed to
retrieve or modify the data.
The view level can describe many views of the same data.
operations:
To persist the changes made by DML commands in database –
COMMIT
To rollback the changes made to the database – ROLLBACK
Database Architecture
Relational DBMS
Operations:
Selection
projection
Cartesian product
Set Operations
Join
Selection (σ)
to fetch rows or tuple from the table.
syntax:
σpredicate(relation)
predicate – logic using which the data from the relation is selected.
Union
Intersection
Set difference
Union:
to fetch data from two relations
the relations specified should have same number
of attributes and same attribute domain.
duplicated tuples are automatically eliminated
from the result.
Syntax: A ᴜ B
Table A1
A B
1 1 A1 ᴜ B1
A B
1 2
1 1
2 1
1 2
Table B1 2 1
2 3
A B
1 2
2 3
Intersection:
to fetch data from both tables which is common in both
the tables.
Syntax: A ∩ B
Table A1
Name id A1 ∩ B1
aaa 1 Name
bbb 2 aaa
ccc 1 ccc
Table B1
Name course
aaa C
ccc C++
Set-Difference:
the result of set difference is tuples, which are present in one
relation but are not in the second relation.
Syntax: A - B
Table A1 A1 - B1
A B A B
1 1 1 1
1 2 2 1
2 1
Table B1
A B
1 2
2 3
Rename Operation:
to rename the output relation for any query relation which returns the
result.
Table A1 Table B1
A B A B
1 1 ρ (A1,B1) 1 1
2 2 2 2
Accessing SQL From a Programming Language
Accessing SQL From a Programming Language
Embedded SQL
PHP
Dynamic SQL: JDBC and ODBC
ODBC works with C, C++, C# and Visual Basic (other APIs such as
ADO.NET sit on top of ODBC).
It was mainly developed for the web but can also be used as
a general-purpose programming language.
3.web server calls the PHP script and incorporates its output
into the response
3.run query