QUEL Query Languages
QUEL Query Languages
QUEL is a relational database access language, similar in most ways to SQL. It was created as a
part of the Ingres effort at University of California, Berkeley, 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 Informix.[citation needed] As
Oracle and DB2 started taking over the market in the early 1980s, most companies then
supporting QUEL moved to SQL instead.[citation needed] QUEL continues to be available as a part of
the Ingres DBMS today, although no QUEL-specific language enhancements have been added
for many years.
[edit] 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 the original Ingres paper:
range of e is employee
retrieve (comp = e.salary / (e.age - 18))
where e.name = "Jones"
e is a tuple, defining a set of data, in this case all the rows in the employee table that have the
first name "Jones". An equivalent SQL statement is:
QUEL is generally more "normalized" than SQL.[citation needed] Whereas every major SQL command
has a format that is at least somewhat different from the others, in QUEL a single syntax is used
for all commands.[citation needed]
For instance, 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).
CREATE TABLE student(name char(10), age int, sex char(1), state char(2))
INSERT INTO student (name, age, sex, state) VALUES ('philip', 17, 'm', 'FL')
SELECT * FROM student WHERE state = 'FL'
UPDATE student SET age=age+1
SELECT * FROM student
DELETE FROM student WHERE name='philip'
Note that every command uses a unique syntax, and that even similar commands like INSERT and
UPDATE use completely different styles.
Another feature of QUEL was a built-in system for moving records en-masse into and out of the
system. Consider this command:
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 into to a from 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:
This example illustrates one of the arguably less desirable quirks of QUEL, namely that all string
comparisons are potentially pattern matches. y.str = "ii*" matches all y.str values starting
with ii.