MySQL – Column Name already named ‘TimeStamp’, need to use it in Where Clause

MySQL – Column Name already named ‘TimeStamp’, need to use it in Where Clause

What’s the proper way to write this query? I have a column named TimeStamp in my customers table. I’m getting errors when trying to find customers who created an account in 2012. I’ve tried:

SELECT 'TimeStamp' AS CreatedDate
FROM customers
WHERE 'CreatedDate' >= '2012-01-01' AND 'CreatedDate' <= '2012-12-31'

and also

SELECT *
FROM customers
WHERE 'TimeStamp' >= '2012-01-01' AND 'TimeStamp' <= '2012-12-31'

and always get no results (there should be thousands)

You must not use single quotes around column names as they are identifiers.

SELECT *
FROM customers
WHERE TimeStamp >= '2012-01-01' AND TimeStamp <= '2012-12-31'

If it happens that your column name is a reserved keyword, you can escape it by using backtick eg,

WHERE `select` ....    -- SELECT is a reserved keyword

or use it along with the tableName

FROM tb
WHERE tb.select ....   -- SELECT is a reserved keyword
.
.
.
.