You can retrieve the list of executed MySQL queries programatically in WordPress to analyse or display them.
First you need to place the below code in wp-config.php file so that WordPress allows you to do so.
Now using the below PHP code you can retrieve the list of queries
<?php
global $wpdb;
$queries = $wpdb->queries; //$queries stores all the queries.
global $wpdb;
$queries = $wpdb->queries; //$queries stores all the queries.