Selecting, updating records in a second database

I need to write competition entries to a second Database not the main Drupal one but I can’t find any instructions on the SQL commands. I have found how to set up the second connection in settings.php but I can’t find how to do a select where on an email address to find out if someone has already entered. The page I have found is


Drupal version: