Home

Relational Algebra

Relational Algebra

Relational Algebra provides a collection of Algebraic operations that operate on relations(or tables) and it  gives output result in the form of tables.

 

   Operation Symbol
 Descriptions           
 1 SELECT
 σ  Select those tuples that satisfy the given Predicate
 2  PROJECT  π  Gives the content of the given Relation
 3  UNION  U  Combine all rows from the given two table
 4  SET DIFFERENCE  --  Given two tables, this gives tuples that are in table 1 but are not in table2
 5 CARTESIAN PRODUCT
 χ  Gives list of all pairs of rows from two tables
 6  RENAME  ρ

Gives a name to the result of relational algebra expressions, we can refer the result with this name

 7  SET-  INTERSECTION
∩   List rows that appear in both tables
 8  JOIN    Combine information from two or more tables
 9  DIVISION  ÷  
 10 ASSIGNMENT
 ←   It is used to store the result of Relational Algebraic expression in temporary variables.

Database Management System

Database Management System

 

  • A Database Management System is a collection of interrelated data and a set of programs to access to those data.
  • The collection of Data is referred as Database.
     
  • The primary goal of a Database Management System(DBMS) is to provide a way to store and retrieve database information that is both convenient and efficient.
Data are very important in any information system. So we must have a very good way of managing such data. The DBMS contain a query language that makes it possible to give quick and exact answers to adhoc queries. The DBMS helps to create an environment in which users have better access to data. Such access makes it possible for end users to respond more quickly and efficiently to changes in their environment.

DBMS helps to give an integrated view of the organization’s operations. Thus it becomes much easier to see how operations in one unit affect others. Data inconsistency is considerably reduced in a properly designed database. Database systems are designed to manage large volume of information. Data management involves both defining the structure for storage of information and providing mechanism for the manipulation of data. Also the database system must ensure the safety of the information stored.

The DBMS makes it possible to share the data in the database among multiple applications and users. DBMS serves as the intermediary between the database and the user by translating user request to the database and getting back exact responses to the user. Also the DBMS hides the internal complexities from the application programs that use the database.
 
 
 
 

Declarative DML (Non Procedural DML)

Declarative DML (Non Procedural DML):

In declarative Data manipulation language user has to specify what data are needed without specifying how to get it.
Example : SQL (Structured Query Languages)

Lock Based Protocols in Databse Transactions

Lock Based Protocols in Databse Transactions

  • Two Phase Locking Protocol
  • Conservative 2PL(Two Phase Locking)
  • Strict 2PL
  • Rigorous 2PL

Two Phase Locking Protocol

Two Phase Locking Protocol  has two phases.Growing Phase and Shrinking Phase. In Growing Phase transaction obtains locks but not releasing any locks.In Shrinking Phase transaction releases locks  and cannot obtain any new locks.Initially the transaction is in growing phase,that is the transaction acquires locks as needed. Once the transaction releases lock, it enters the shrinking phase and no more lock request may be issued. Upgrading of lock is not possible in shrinking phase, but it is possible in growing phase. The two phase locking protocol ensures serializability.
 
Conservative 2PL(Two Phase Locking)
In conservative 2PL there is no growing Phase, Only having shrinking Phase.It gets all the locks before the execution starts .
 

Strict 2PL
Not releasing the write lock (Exclusive Lock) until commit.

 

Rigorous 2PL
First commit then release the lock.

Procedural DML

Procedural DML

In procedural Data manipulation language user has to specify what data are needed and how to get it.