When I perform an advanced search I would like to see the query that is created based on the criteria I have chosen in the Advanced Search. Is there a way to see the query that is created?
civicrm.settings.php, you can enable:
Then run the "Advanced Search" and look at the output in
files/civicrm/ConfigAndLog/CiviCRM*log*. This will output for several queries; to avoid accumulation of junk data, you should probably disable the
CIVICRM_DEBUG_LOG_QUERY after running the query.
There's some more discussion of this and other debugging techniques at http://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers