QUEL query languages
Encyclopedia
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
. As Oracle
and DB2
started taking over the market 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 today, although no QUEL-specific language enhancements have been added for many years.
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:
select (e.salary / (e.age - 18)) as comp
from employee as e
where e.name = "Jones"
QUEL is generally more "normalized" than SQL. 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.
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 student(name = c10, age = i4, sex = c1, state = c2)
range of s is student
append to s (name = "philip", age = 17, sex = "m", state = "FL")
retrieve (s.all) where s.state = "FL"
replace s (age=s.age+1)
retrieve (s.all)
delete s where s.name="philip"
Here is a similar set of SQL statements:
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
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
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.
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...
access language, similar in most ways to SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....
. It was created as a part of the Ingres effort at University of California, Berkeley
University of California, Berkeley
The University of California, Berkeley , is a teaching and research university established in 1868 and located in Berkeley, California, USA...
, based on Codd
Edgar F. Codd
Edgar Frank "Ted" Codd was an English computer scientist who, while working for IBM, invented the relational model for database management, the theoretical basis for relational databases...
'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
Informix
IBM Informix is a family of relational database management system developed by IBM. It is positioned as IBM's flagship data server for online transaction processing as well as integrated solutions...
. As Oracle
Oracle database
The Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....
and DB2
IBM DB2
The IBM DB2 Enterprise Server Edition is a relational model database server developed by IBM. It primarily runs on Unix , Linux, IBM i , z/OS and Windows servers. DB2 also powers the different IBM InfoSphere Warehouse editions...
started taking over the market 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 today, 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 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:
select (e.salary / (e.age - 18)) as comp
from employee as e
where e.name = "Jones"
QUEL is generally more "normalized" than SQL. 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.
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 student(name = c10, age = i4, sex = c1, state = c2)
range of s is student
append to s (name = "philip", age = 17, sex = "m", state = "FL")
retrieve (s.all) where s.state = "FL"
replace s (age=s.age+1)
retrieve (s.all)
delete s where s.name="philip"
Here is a similar set of SQL statements:
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:
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
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:
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.
y.str = "ii*"
matches all y.str values starting with ii.See also
- Tutorial D
- D (data language specification)D (data language specification)D is a set of requirements for what Christopher J. Date and Hugh Darwen believe a relational database query language ought to be like. It is proposed in their book The Third Manifesto.-Overview:...
- D4 (programming language)D4 (programming language)D4 is a computer language used in Dataphor, a relational database management system.-Syntax:Alphora, the creators of D4, have given it a Pascal like syntax...
(an implementation of D) - Relational algebraRelational algebraRelational algebra, an offshoot of first-order logic , deals with a set of finitary relations that is closed under certain operators. These operators operate on one or more relations to yield a relation...
- Relational calculusRelational calculusRelational 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...
External links
- C. J. Date: A Critique of the SQL Database Language. SIGMOD Record 14(3): 8-54, 1984.