# Object Query Language

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Object_Query_Language
> Markdown URL: https://mediated.wiki/source/Object_Query_Language.md
> Source: https://en.wikipedia.org/wiki/Object_Query_Language
> Source revision: 1329628224
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Query language for object-oriented databases

This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. Please help improve this article by introducing more precise citations. (March 2025) (Learn how and when to remove this message)

**Object Query Language** (**OQL**) is a [query language](/source/Query_language) standard for [object-oriented databases](/source/Object_database) modeled after [SQL](/source/SQL) and developed by the [Object Data Management Group](/source/Object_Data_Management_Group) (ODMG). Because of its overall complexity the complete OQL standard has not yet been fully implemented in any software. The OQL standard influenced the design of later query languages such as [JDOQL](https://en.wikipedia.org/w/index.php?title=JDOQL&action=edit&redlink=1) and [EJB QL](/source/EJB_QL), though none are considered to be any version of OQL.

## General rules

The following rules apply to OQL statements:

- All complete statements must be terminated by a semi-colon.

- A list of entries in OQL is usually separated by commas but not terminated by a comma.

- Strings of text are enclosed by matching quotation marks.

## Examples

### Simple query

The following example illustrates how one might retrieve the [CPU](/source/CPU)-speed of all PCs with more than 64MB of [RAM](/source/Random-access_memory) from a fictional [PC](/source/Personal_computer) database:

SELECT pc.cpuspeed
FROM PCs pc
WHERE pc.ram > 64;

### Query with grouping and aggregation

The following example illustrates how one might retrieve the average amount of [RAM](/source/Random-access_memory) on a [PC](/source/Personal_computer), grouped by manufacturer:

SELECT manufacturer, AVG(SELECT part.pc.ram FROM partition part)
FROM PCs pc
GROUP BY manufacturer: pc.manufacturer;

Note the use of the keyword partition, as opposed to aggregation in traditional SQL.

## See also

- [Object Data Management Group](/source/Object_Data_Management_Group) (ODMG)

- Object Definition Language

## References

- Dietrich, Suzanne; Urban, Susan (31 May 2022). ["2.4 The ODMG Query Language"](https://books.google.com/books?id=JYdyEAAAQBAJ&dq=%22Object+Query+Language%22+-wikipedia&pg=PA31). *Fundamentals of Object Databases*. [Springer Nature](/source/Springer_Nature). pp. 31–52. [ISBN](/source/ISBN_(identifier)) [978-3-031-01844-2](https://en.wikipedia.org/wiki/Special:BookSources/978-3-031-01844-2).

- Cattell, Roderic Geoffrey Galton; Barry, Douglas K.; Berler, Mark (2000). "Object Query Language". [*The Object Data Standard: ODMG 3.0*](https://books.google.com/books?id=2-FF-aQ_twQC). [Morgan Kaufmann](/source/Morgan_Kaufmann). pp. 89–152. [ISBN](/source/ISBN_(identifier)) [978-1-55860-647-0](https://en.wikipedia.org/wiki/Special:BookSources/978-1-55860-647-0). Retrieved 31 March 2025.

v t e Query languages In current use .QL ALPHA CQL Cypher DAX DMX Datalog GraphQL Graph Query Language Gremlin ISBL LDAP LINQ MQL MDX OQL OCL QUEL RDF SMARTS SPARQL SQL XQuery XPath YQL Proprietary YQL LINQ Superseded CODASYL

This software-engineering-related article is a stub. You can help Wikipedia by adding missing information.

- [v](https://en.wikipedia.org/wiki/Template:Software-eng-stub)
- [t](/source/Template_talk%3ASoftware-eng-stub)
- [e](https://en.wikipedia.org/wiki/Special:EditPage/Template:Software-eng-stub)

This programming-language-related article is a stub. You can help Wikipedia by adding missing information.

- [v](https://en.wikipedia.org/wiki/Template:Prog-lang-stub)
- [t](/source/Template_talk%3AProg-lang-stub)
- [e](https://en.wikipedia.org/wiki/Special:EditPage/Template:Prog-lang-stub)

---
Adapted from the Wikipedia article [Object Query Language](https://en.wikipedia.org/wiki/Object_Query_Language) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Object_Query_Language?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
