Previous Topic: TaskNext Topic: RELATIONSHIP (Relationship of an Entity Type or Subtype)


Task

Select entity type name and attribute name for those attributes that are identifiers. Order by entity type name.

SELECT E.NAME, A.NAME
  FROM
  MODEL M,
  ENTITY_TYPE E,
  ATTR_IDENT I,
  ATTRIBUTE A
  WHERE
  M.NAME = 'my model name'
  AND E.MODEL_ID = M.ID
  AND A.PARENT_ENTITY_ID = E.ID
  AND I.ENTITY_ID = E.ID
  AND I.ATTRIBUTE_ID = A.ID
ORDER BY E.NAME;

Note: The table IDENTIFIER contains both attribute identifiers and relationship identifiers. Therefore, the table ATTR_IDENT can be replaced with the table IDENTIFIER.