Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

QUEL query languages

From Wikipedia, the free encyclopedia
Relational database access language
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "QUEL query languages" – news ·newspapers ·books ·scholar ·JSTOR
(November 2013) (Learn how and when to remove this message)
QUEL
FamilyQuery language
Designed byMichael Stonebraker
First appeared1976; 50 years ago (1976)
Majorimplementations
Ingres, POSTQUEL
Influenced by
Alpha

QUEL is arelational databasequery language, based ontuple relational calculus, with some similarities toSQL. It was created as a part of theIngresDBMS effort atUniversity of California, Berkeley, based onCodd's earlier suggested but not implementedData 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 byPOSTGRES.[1]

Eugene Wong of Ingres was the creator of QUEL.[2] AsOracle andIBM DB2 gained market share in the early 1980s, Ingres and other companies supporting QUEL moved to SQL.[3][2] QUEL continues to be available as a part of the Ingres DBMS, although no QUEL-specific language enhancements have been added for many years.[when?]

Usage

[edit]

QUEL statements are always defined bytuple variables, which can be used to limit queries or return result sets. Consider this example, taken from one of the first original Ingres papers:[4]

range of E is EMPLOYEEretrieve into W(COMP = E.Salary / (E.Age - 18))where E.Name = "Jones"

HereE is a tuple variable that ranges over theEMPLOYEE relation, and all tuples in that relation are found which satisfy the qualificationE.Name = "Jones". The result of the query is a new relationW, which has a single domainCOMP that has been calculated for each qualifying tuple. Additional queries can then be made against the relationW.

An equivalent SQL statement is:

createtableWasselect(E.salary/(E.age-18))asCOMPfromemployeeasEwhereE.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).

QUELSQL
create student(name = c10, age = i4, sex = c1, state = c2)range of s is studentappend 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"
createtablestudent(namechar(10),ageint,sexchar(1),statechar(2));insertintostudent(name,age,sex,state)values('philip',17,'m','FL');select*fromstudentwherestate='FL';updatestudentsetage=age+1;select*fromstudent;deletefromstudentwherename='philip';

Another feature of QUEL was a built-in system for moving records en-masse into and out of the system. Consider this command:

copystudent(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 theinto to afrom 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 tostored 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.ibyy.dwherey.str="ii*"ory.str="foo"),b=max(count(y.ibyy.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 ally.str values starting withii. In contrast, SQL uses= only for exact matches, whilelike is used when pattern matching is required.

See also

[edit]

References

[edit]
  1. ^Stonebraker, M; Rowe, LA (May 1986).The design of POSTGRES(PDF). Proc. 1986ACM SIGMOD Conference on Management of Data. Washington, DC.
  2. ^ab"RDBMS Plenary 1: Early Years"(PDF) (Interview). Interviewed by Burton Grad. Computer History Museum. 2007-06-12. p. 26. Retrieved2025-05-30.
  3. ^Morgenthaler, Gary (2005-12-08)."Oral History of Gary Morgenthaler"(PDF) (Interview). Interviewed by Luann Johnson. Computer History Museum. p. 18. Retrieved2025-05-30.
  4. ^Stonebraker, Michael; Wong, Eugene; Kreps, Peter; Held, Gerald (1976). "The Design and Implementation of INGRES".ACM Transactions on Database Systems.1 (3): 191.CiteSeerX 10.1.1.109.957.doi:10.1145/320473.320476.

Further reading

[edit]
In current use
Proprietary
Superseded
Authority control databases: NationalEdit this at Wikidata
Retrieved from "https://en.wikipedia.org/w/index.php?title=QUEL_query_languages&oldid=1305816854"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp