From a SQL Query I need to know how does magento key the related products to the actual product itself. I read a lot of useful tips on how to do with with php
$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSort('name', 'ASC');
But I need to know how to identity these groups to a id with mysql.
For a related product Magento uses
catalog_product_linktable.In it you have product id, related product and link type.
To see all link types you can check the
catalog_product_link_typetable.More extensive information can be found with this link:
online Database Diagram Tool dedicated to Magento eCommerce CE Edition