Querying objects: OQL and object-relational SQL
OQL queries from the ODMG standard, persistence by reachability and SQL's object extensions in PostgreSQL: composite types, arrays, table inheritance.
- 23 cards
- 4 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
A few cards from the deck
OQL: what is it?
Show the answer
The ODMG standard's query language for object databases, shaped like SQL but querying classes and their references.
select e.nom from e in Etudiants where e.promo.annee = 2walks a class extent and follows a reference without a join.The students are Ana (first-year cohort), Bo and Cy (second-year cohort) and Di (third-year cohort). What does
select e.nom from e in Etudiants where e.promo.annee = 2return?- Bo and Cy
- Ana and Bo
- Bo, Cy and Di
- Bo only
Show the answer
Bo and Cy
The path
e.promo.anneefollows the student's reference to their cohort and reads the year. Only students whose cohort has year 2 are returned: Bo and Cy.The … standard defined a query language for object databases, ….
Show the answer
The ODMG standard defined a query language for object databases, OQL.
It also set an object definition language and bindings with C++, Smalltalk and Java.
Path expression: what is it?
Show the answer
A series of names separated by dots that traverses attributes and object references from object to object.
e.promo.anneereplaces a relational database's join: you navigate from the student to their cohort then to the year.personnehas a primary key onid. A row whoseidalready exists inpersonneis inserted into the child tableetudiant, and PostgreSQL accepts it. What is the cause?- The primary key checks only the table's own rows, not its children's
- The primary key is disabled by inheritance across the hierarchy
- The child's
idis a different type from the parent's INSERTnever checks primary keys
Show the answer
The primary key checks only the table's own rows, not its children's
Uniqueness constraints do not cross inheritance: the primary key's index covers only
personne, and the child does not even inherit the constraint. Anidcan thus appear twice when you read the parent with its children.