Find entities within all cards
This query retrieves entities contained within all cards. Cards might contain entities of different types, including ports, slots, and sensors. The query lists each of the cards identified and, for each card, lists the entities contained within the card.
This query does not traverse the entire containment tree within the card. Therefore, the query only retrieves components at the top level within the card.
This query uses the contains table. This table defines all the
containment relationships between entities. Each row in the contains
table holds a pair of entity identifiers: the containing entity and the
contained entity identifier. For each card identified, the query joins to the
contains table and extracts information about one of the
entities contained within that card.
Example
1] SELECT container.entityName Card_Name,
2] m.cardNumber Card_Number,
3] part.entityName Contained_Entity
4] FROM physicalCard m
5] INNER JOIN entityData container ON container.entityId = m.entityId
6] INNER JOIN contains c ON c.containingEntityId = m.entityId
7] INNER JOIN entityData part ON part.entityId = c.containedEntityId
8] ORDER BY container.entityName
The table below describes this query.
|
Line numbers |
Description |
|---|---|
|
1-3 |
Specify the data to show in the results, as follows:
|
|
4 |
Use the physicalCard table as the driving table for this query. The |
|
5 |
For each card, extract the full set of entity data for that card. This ensures that the entity
name of the card is retrieved for display in the query results, as specified in line 1). Use the
alias Do this by specifying an |
|
6 |
For each card, extract records from the Do this by specifying an The query extracts a record from the |
|
7 |
Extract the full set of entity data for each contained entity. Use the alias
Do this by specifying a second |
|
8 |
To facilitate readability of the results, order by the entity name of the containing card. |
The table below shows the results of this query.
|
Card name |
Card number |
Contained entity |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|