OSCommerce & OpenCart Attributes SQL

SQL query shows the relationship between different attribute tables:

SELECT agd.name AS group_name, ad.attribute_id, ad.name AS attribute_name
FROM oc_attribute_description ad
JOIN oc_attribute a ON ad.attribute_id = a.attribute_id
JOIN oc_attribute_group_description agd ON agd.attribute_group_id = a.attribute_group_id
ORDER BY group_name, attribute_name

For example:

group_name attribute_name
Color Black
Color Purple
Color Red
Color Silver
Color White