- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Query is a question or requesting information. Query language is a language which is used to retrieve information from a database.

Query language is divided into two types −

Procedural language

Non-procedural language

Information is retrieved from the database by specifying the sequence of operations to be performed.

For Example: Relational algebra.

Structure Query language (SQL) is based on relational algebra.

Relational algebra consists of a set of operations that take one or two relations as an input and produces a new relation as output.

The different types of relational algebra operations are as follows −

Select operation

Project operation

Rename operation

Union operation

Intersection operation

Difference operation

Cartesian product operation

Join operation

Division operation

Union, intersection, difference, cartesian, join, division comes under binary operation (operate on two table).

The division operator is used for queries which involve the ‘all’.

R1 ÷ R2 = tuples of R1 associated with all tuples of R2.

Retrieve the name of the subject that is taught in all courses.

Name | Course |
---|---|

System | Btech |

Database | Mtech |

Database | Btech |

Algebra | Btech |

÷

Course |
---|

Btech |

Btech |

=

Name |

database |

The resulting operation must have all combinations of tuples of relation S that are present in the first relation or R.

Retrieve name of employees who work on all the projects that John Smith works on.

Consider the Employee table given below −

Name | Eno | Pno |
---|---|---|

John | 123 | P1 |

Smith | 123 | P2 |

A | 121 | P3 |

÷

Works on the following −

Eno | Pno | Pname |
---|---|---|

123 | P1 | Market |

123 | P2 | Sales |

=

The result is as follows

Eno |
---|

123 |

The expression is as follows

Smith <- ΠPno(σEname = ‘john smith’ (employee * works on Pno=Eno))

- Related Questions & Answers
- Explain rename operation in relational algebra (DBMS)?
- Explain project operation in relational algebra (DBMS)?
- Explain intersection operation in relational algebra (DBMS)?
- Explain union operation in relational algebra (DBMS)?
- Explain the select operation in relational algebra (DBMS)?
- Explain the relational algebra in DBMS?
- What is join operation in relational algebra (DBMS)?
- Explain cartesian product in relational algebra (DBMS)?
- Explain the binary operations in relational algebra (DBMS)?
- Explain the evaluation of relational algebra expression(DBMS)
- Write queries using aggregate functions in relational algebra (DBMS)?
- Explain the Relational Model in DBMS?
- Difference between Relational Algebra and Relational Calculus
- Basic Operators in Relational Algebra
- Explain the unary operations of algebra relations in DBMS?

Advertisements