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 as follows −
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 −
Cartesian product operation
Select, project, rename comes under unary operation (operate on one table). Union, intersection, difference, cartesian, join, division comes under binary operation (operate on two tables).
Information is retrieved from the database without specifying the sequence of operation to be performed. Users only specify what information is to be retrieved.
For Example: Relational Calculus
Query by Example (QBE) is based on Relational calculus
Relational calculus is a non-procedural query language in which information is retrieved from the database without specifying sequence of operation to be performed.
Relational calculus is of two types which are as follows −