Object Query Language
This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Object_Query_Language"
.

Object Query Language (OQL) is a query language standard for object-oriented databases modelled after SQL. OQL was developed by the Object Data Management Group (ODMG). Because of its overall complexity no vendor has ever fully implemented the complete OQL. OQL has influenced the design of some of the newer query languages like JDOQL and EJBQL, but they can't be considered as different flavours of OQL.

content

Contents

Examples

Key Differences Between OQL and SQL

OQL differs from SQL in that:

  • OQL supports object referencing within tables. Objects can be nested within objects.
  • Not all SQL keywords are supported within OQL. Keywords that are not relevant to Netcool/Precision IP have been removed from the syntax.
  • OQL can perform mathematical computations within OQL statements.

General Rules of OQL

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.

Simple query

The following example illustrates how one might retrieve the CPU-speed of all PCs with more than 64MB of RAM from a fictional PC 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 on a PC, 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

ODMG - Object Data Management Group


© jGames.co.uk 2007 (some content from Wikipedia under GDL ) !-- ValueClick Media 468x60 and 728x90 Banner CODE for jgames.co.uk -->
Your Ad Here