Zend certified PHP/Magento developer

What PHP class executes the SQL to select models and collections from the database?

When I have a PHP model or collection of a Magento entity (such as a product or customer), what PHP class(es) is in charge of constructing and executing the SQL that selects that model or collection of models from the database?