[DBTablesMonitor] Implement the distinct code for MySQL.

As written in the comment in the source code, we want to use the
SQL statement that is independent of a backend SQL system.
We'll do it later.