When building more complex queries using
db_select() you will often want to see the exact SQL being generated. This is helpful for understanding the query or simply debugging the results.
This article will show you how to see the exact query being generated with
db_select() as well as getting how to get all values passed as arguments. The code in this article will be applicable for both Drupal 7 and Drupal 8.