Previous Topic: Typical JoinNext Topic: Constraint on Number of Joins


Join Example

The following example uses three joins to select all entity types and their attributes from model “my model.” It orders entity types by name and attributes as they occur in the Entity Relationship Diagram (ERD).

SELECT E.NAME, A.NAME, A.LENGTH, A.DOMAIN, A.SEQ
FROM
MODEL M,
ENTITY_TYPE E,
ATTRIBUTE A
WHERE
M.NAME='MY MODEL'
AND E.MODEL_ID=M.ID
AND A.PARENT_ENTITY_ID=E.ID
ORDERBY E.NAME,A.SEQ;