Thursday 28 April 2016

RELATIONAL ALGEBRA

A set of operators used to perform operations on tables is called as relational algebra. Operators in relational algebra take one or more tables as parameters and produce one table as the result.

The following are operators in relational algebra:

  • Union 
  • Intersect  
  • Difference or minus
  • Project 
  • Select 
  • Join 

   Union :This takes two tables and returns all rows that are belonging to either first or second table (or both).

                                                                                                                                           Intersect : This takes two tables and returns all rows that are belonging to first and second table.

Difference or Minus : This takes two tables and returns all rows that exist in the first table and not in the second table

Project :Takes a single table and returns the vertical subset of the table.

Select : Takes a single table and returns a horizontal subset of the table. That means it returns only those rows that satisfy the condition.

Join : Rows of two table are combined based on the given column(s) values. The tables being joined must have a common column.


Structured Query Language (SQL) :



 Almost all relational database management systems use SQL (Structured Query Language) for data manipulation and retrieval. SQL is the standard language for relational database systems. SQL is a non-procedural language, where you need to concentrate on what you want, not on how you get it. Put it in other way, you need not be concerned with procedural details. SQL Commands are divided into four categories, depending upon what they do.

  • DDL (Data Definition Language) 
  • DML (Data Manipulation Language)
  • DCL (Data Control Language)  
  • Query (Retrieving data)

DDL  (Data Definition Language): commands are used to define the data. For example, CREATE TABLE. 

DML (Data Manipulation Language) :commands such as, INSERT and DELETE are used to manipulate data.

DCL (Data Control Language)  : commands are used to control access to data. For example, GRANT.

Query (Retrieving data) :  is used to retrieve data using SELECT.

DML and Query are also collectively called as DML. And DDL and DCL are called as DDL.

No comments:

Post a Comment