Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Usage  





2 See also  





3 References  





4 Further reading  














QUEL query languages







Polski
Português
Русский
Українська
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


QUEL
FamilyQuery language
Designed byMichael Stonebraker
First appeared1976; 48 years ago (1976)
Major implementations
Ingres, POSTQUEL
Influenced by
Alpha

QUEL is a relational database query language, based on tuple relational calculus, with some similarities to SQL. It was created as a part of the Ingres DBMS 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 in an implementation called POSTQUEL supported by POSTGRES.[1]AsOracle and DB2 gained market share 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, although no QUEL-specific language enhancements have been added for many years.[when?]

Usage[edit]

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:[2]

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).

QUEL SQL
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"
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';

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. In contrast, SQL uses = only for exact matches, while like 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. 1986 ACM SIGMOD Conference on Management of Data. Washington, DC.
  • ^ 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]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=QUEL_query_languages&oldid=1220197674"

    Categories: 
    Database management systems
    Query languages
    PostgreSQL
    Relational database management systems
    Hidden categories: 
    Articles needing additional references from November 2013
    All articles needing additional references
    All articles with unsourced statements
    Articles with unsourced statements from August 2014
    All articles with vague or ambiguous time
    Vague or ambiguous time from December 2011
    Articles with J9U identifiers
    Articles with LCCN identifiers
     



    This page was last edited on 22 April 2024, at 11:23 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki