Corrected MySQL and MonetDB queries