Login Statistics

1. Last login time per User

USE CASE:

  • Retrieve the last login time for User (user_id)
  • This will show the time when a User last entered their login and password
  • Recommendation: use to build a Metric
SELECT user_id, 
IFNULL(last_login_time, 'not available') AS Last_login_date
FROM user
GROUP BY 1
2. List of Users since last login time

USE CASE:

  • Retrieve a list of Users since last login time 
  • Show User information, last login time, and the count of days since that time until now
  • Recommendation: use to build a Report
SELECT username, first_name, last_name, 
IFNULL(last_login_time, 'Not Available') AS Last_login_date, 
DATEDIFF(CURDATE(),last_login_time) AS Days_since_last_login
FROM user