- 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

Select, project, rename comes under unary operation (operate on one table).

It displays the specific column of a table. It is denoted by pie (∏). It is a vertical subset of the original relation. It eliminates duplicate tuples.

The syntax is as follows −

∏_{regno}(student)

Consider the student table:

Regno | Branch | Section |
---|---|---|

1 | CSE | A |

2 | ECE | B |

3 | CIVIL | B |

4 | IT | A |

To display regno column of student table, we can use the following command −

∏_{regno}(student)

RegNo |
---|

1 |

2 |

3 |

4 |

To display branch, section column of student table, use the following command −

∏branch,section(student)

The result is as follows −

Branch | Section |
---|---|

CSE | A |

ECE | B |

CIVIL | B |

IT | A |

To display regno, section of ECE students, use the following command −

∏regno,section(σbranch=ECE(student))

Regno | Section |
---|---|

2 | B |

**Note:** Conditions can be written in select operation but not in projection operation.

Consider the employee table to know more about projection.

If no condition is specified in the query then, Π empid, ename, salary, address, dno (emp).

If condition is specified then, the composition of the select and projection is as follows −

∏ empid, ename, salary, address, dno (σ salary >20,00 ^ LOC = HOD ^ dno=20) (emp)

- Related Questions & Answers
- Explain rename operation in relational algebra (DBMS)?
- Explain intersection operation in relational algebra (DBMS)?
- Explain union operation in relational algebra (DBMS)?
- Explain division 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