You can just do man which for details:
DESCRIPTION
which returns the pathnames of the files (or links) which would be executed in the current environment,
had its arguments been given as commands in a strictly POSIX-conformant shell. It does this by search‐
ing the PATH for executable files matching the names of the arguments. It does not follow symbolic
links.
So which mysql just returns current path of the mysql command.
However use of which in your examples just makes sure to ignore any alias set for mysql in your current environment.
However there is another clever shortcut to avoid which in shell. You can use call mysql with backslash:
\mysql -uroot -ppass -e "SELECT * FROM whatever"
This will be effectively same as what your 2 commands are doing.
From OP: The only reason to use which is to avoid possible problems with custom aliases (like alias mysql="mysql -upeter -ppaula"). And since it is pretty unlikely somebody would set an alias for say echo, we don't need this construction with echo. But it is very common to set an alias for mysql (nobody wants to memorize and type the 24 chars long password).