Sandbox solution: Everything including sharepoint service, database, auhthentication etc should be installed in same machine.
Farm solution: Sharepoint service, database, other services can be distributed in different machines and thus creates a sharepoint farm.
Here I have tried to provide some useful links to have knowledge on sharepoint.
http://mahmudisblogging.blogspot.com/2011/10/sharepoint-server-2010-learning-steps.html[
^]