select
    a.entity_type,
    b.entity_id,
    b.attribute_type,
    b.attribute_value
from
    entity a
    join
    attribute b
    on a.id = b.entity_id
order by
    a.entity_type,
    b.entity_id,
    b.attribute_type;
