So far we’ve been using the signup_date
column in the users
table to filter data:
SELECT COUNT(*) FROM users WHERE signup_date BETWEEN '2018-01-01' AND '2018-01-07'
As you remember, signup_date
is simply a date when a user signed up (in other words, when a record in the users table was created). The signup timestamp is stored inside the created_at
column which has type datetime. We can use the created_at
column for our filter the same way:
SELECT COUNT(*) FROM users WHERE created_at BETWEEN '2018-01-01' AND '2018-01-07'
SQL will figure out that...