QUEL query languages
   HOME

TheInfoList



OR:

QUEL is a
relational database A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relati ...
query language, based on tuple relational calculus, with some similarities to SQL. It was created as a part of the
Ingres Jean-Auguste-Dominique Ingres ( , ; 29 August 1780 – 14 January 1867) was a French Neoclassical painter. Ingres was profoundly influenced by past artistic traditions and aspired to become the guardian of academic orthodoxy against the a ...
DBMS In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases ...
effort at
University of California, Berkeley The University of California, Berkeley (UC Berkeley, Berkeley, Cal, or California) is a public land-grant research university in Berkeley, California. Established in 1868 as the University of California, it is the state's first land-grant un ...
, based on Codd's earlier suggested but not implemented ''Data Sub-Language ALPHA''. QUEL was used for a short time in most products based on the freely available Ingres source code, most notably in an implementation called POSTQUEL supported by
POSTGRES PostgreSQL (, ), also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. It was originally named POSTGRES, referring to its origins as a successor to the Ingr ...
. As
Oracle An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination. Description The word ...
and DB2 gained market share in the early 1980s, most companies then supporting QUEL moved to SQL instead. QUEL continues to be available as a part of the Ingres DBMS, although no QUEL-specific language enhancements have been added for many years.


Usage

QUEL statements are always defined by ''tuple variables'', which can be used to limit queries or return result sets. Consider this example, taken from one of the first original Ingres papers: range of E is EMPLOYEE retrieve into W (COMP = E.Salary / (E.Age - 18)) where E.Name = "Jones" Here E is a tuple variable that ranges over the EMPLOYEE relation, and all tuples in that relation are found which satisfy the qualification `E.Name = "Jones"`. The result of the query is a new relation W, which has a single domain COMP that has been calculated for each qualifying tuple. Additional queries can then be made against the relation W. An equivalent SQL statement is: create table W as select (E.salary / (E.age - 18)) as COMP from employee as E where E.name = 'Jones' In this example, the relation is being stored in a new table W. This is not a direct analog of the QUEL version; relations in QUEL are more similar to temporary tables seen in most modern SQL implementations. Here is a sample of a simple session that creates a table, inserts a row into it, and then retrieves and modifies the data inside it and finally deletes the row that was added (assuming that name is a unique field). Another feature of QUEL was a built-in system for moving records en-masse into and out of the system. Consider this command: copy student(name=c0, comma=d1, age=c0, comma=d1, sex=c0, comma=d1, address=c0, nl=d1) into "/student.txt" which creates a comma-delimited file of all the records in the student table. The d1 indicates a delimiter, as opposed to a data type. Changing the to a reverses the process. Similar commands are available in many SQL systems, but usually as external tools, as opposed to being internal to the SQL language. This makes them unavailable to stored procedures. QUEL has an extremely powerful aggregation capability. Aggregates can be nested, and different aggregates can have independent by-lists and/or restriction clauses. For example: retrieve (a=count(y.i by y.d where y.str = "ii*" or y.str = "foo"), b=max(count(y.i by y.d))) This example illustrates one of the arguably less desirable quirks of QUEL, namely that all string comparisons are potentially pattern matches. matches all values starting with . In contrast, SQL uses only for exact matches, while is used when pattern matching is required.


See also

*
D4 (programming language) Dataphor is an open-source truly-relational database management system (RDBMS) and its accompanying user interface technologies, which together are designed to provide highly declarative software application development. The Dataphor Server has i ...
(an implementation of D) * Relational algebra *
Relational calculus The relational calculus consists of two calculi, the tuple relational calculus and the domain relational calculus, that are part of the relational model for databases and provide a declarative way to specify database queries. The raison d'être ...


References


Further reading

* C. J. Date
A Critique of the SQL Database Language
SIGMOD Record 14(3): 8-54, 1984. {{Authority control Database management systems Query languages PostgreSQL Relational database management systems