mysql | find duplicates¶
SELECT name, COUNT(*) c FROM table GROUP BY name HAVING c > 1;
mysql | do a timediff¶
SELECT TIMEDIFF('2007-12-31 10:02:00','2007-12-30 12:01:01');
-- result: 22:00:59.
SELECT TIMESTAMPDIFF(SECOND,'2007-12-30 12:01:01','2007-12-31 10:02:00');
-- result: 79259 the difference in seconds with the time.
mysql | get a list of users¶
SELECT User FROM mysql.user;