Oracle SQL 日期之间不显示任何数据

Oracle SQL date between not showing any data

这是我的 table:

我想得到的是 SESSIONDATE 在 6 月的所有内容, 我正在使用我的代码:

SELECT * FROM CONFERENCESESSION
WHERE SESSIONDATE BETWEEN '01-06-17' AND '30-06-17';

结果为空,因为我没有使用此代码得到任何结果。

您可以将 trunc 函数与 'MONTH' 一起使用以获得 2017 年 6 月:

SELECT * FROM CONFERENCESESSION
WHERE trunc(SESSIONDATE, 'MONTH') = trunc(to_date('06-17','MM-YY'),'MONTH')

The TRUNC (date) function returns date with the time portion of the day truncated to the unit specified by the format model fmt.

SELECT * FROM CONFERENCESESSION
WHERE SESSIONDATE BETWEEN to_date('01-06-17','DD-MM-YY') 
AND to_date('30-06-17','DD-MM-YY');