MySQL
MySQL Datasource Connector Details
Last updated
SELECT STR_TO_DATE('01-01-2021 01:25:20 PM', '%d-%m-%Y %r');SELECT CAST(column_name AS CHAR) FROM table_name;SELECT column_name + '' FROM table_name;
-- MySQL treats + as string concatenation in this context, implicitly converting column_name to a stringSELECT CONCAT(column_name, '') FROM table_name;
-- CONCAT function automatically converts and concatenates the values as stringsSELECT DATE_FORMAT(date_column, '%Y-%m-%d %H:%i:%s') FROM table_name; -- Formats a date/datetime value as a stringSELECT CAST(column_name AS SIGNED) FROM table_name;SELECT CAST(column_name AS DECIMAL(10,2)) FROM table_name; -- Where 10 is the precision and 2 is the scaleSELECT column_name + 0 FROM table_name; -- Converts to a number by adding zeroSELECT DATE_FORMAT(SaleDate, '%Y-%m-01') as MonthStart, sum(sales) as MonthSales
FROM SalesData
GROUP BY DATE_FORMAT(SaleDate, '%Y-%m-01')