ETL: SQL Set column type
Is there a way to set the column type of while you are creating the column in mysql? I have a column that I am creating based on a date (Min Cust Svc Start) and a comparison to another date (1/1/2015). I want "Min Cust Svc Start 15" to be a datetype column; however, it is defaulting to text. I know I can change it in alter tab but am wondering if there is a way to change it in the query below (while I am creating the field)? Also, am looking for guidance on which is the preferred method...
WHEN `Min Cust Svc Start` < '2015-01-01' THEN
ELSE `Min Cust Svc Start`
END AS `Min Cust Svc Start 15`
from `transform_cust_svc` tc