Spam comments in WordPress is a real problem. There are tons of theme daily.
If you want to delete those comments, here are some useful MySQL queries for you.
Delete all comments
$query = "DELETE FROM {$wpdb->prefix}comments";
Delete unapproved comments
$query = "DELETE FROM {$wpdb->prefix}comments WHERE comment_approved = '0'";
Delete Spam comments
$query = "DELETE FROM {$wpdb->prefix}comments WHERE comment_approved = 'spam'";
Delete Trash comments
$query = "DELETE FROM {$wpdb->prefix}comments WHERE comment_approved = 'trash'";
Delete unapproved comments of which URL field has a link
$query = "DELETE FROM {$wpdb->prefix}comments WHERE comment_approved != '1' AND comment_author_url != ''";
There are comments’ containt has links (a tag). Most of them are spam for sure.
$query = "DELETE FROM {$wpdb->prefix}comments WHERE comment_approved != '1' AND (comment_content like '%http://%' or comment_content like '%https://%')";
Use these queries in code
global $wpdb;
//get $query from one above
$wpdb->query($wpdb->prepare($query));
I made a plugin for this purpose. You can download it here.