在SQL中,使用substring()函数可以对日期和时间字段进行处理。下面是一些示例:
SELECT SUBSTRING(date_column, 1, 4) AS year
FROM table_name;
SELECT SUBSTRING(date_column, 6, 2) AS month
FROM table_name;
SELECT SUBSTRING(date_column, 9, 2) AS day
FROM table_name;
SELECT SUBSTRING(time_column, 1, 2) AS hour
FROM table_name;
SELECT SUBSTRING(time_column, 4, 2) AS minute
FROM table_name;
请根据实际情况调整substring()函数中的参数,以确保正确提取日期和时间字段中的所需部分。