3.4.1 Combinations of data types that can be compared

The following table shows the combinations of data types that can be compared in the search condition specified in the WHERE or HAVING clause. For details about the WHERE clause, see 4.4.6 WHERE clause. For details about the HAVING clause, see 4.4.8 HAVING clause.

The comparison rules explained here also apply to the GROUP BY clause and aggregate functions.

Table 3-8 Combinations of data types that can be compared

No.Data typeNumeric dataCharacter dataDate dataTime dataTimestamp data
1Numeric dataYDNNN
2Character dataDYDDD
3Date dataNDYNN
4Time dataNDNYN
5Timestamp dataNDNNY
Legend:
Y: Can be compared.
D: Can be compared depending on the condition. For details about the cases that can be compared, see 3.4.2(2) Comparison of character data.
N: Cannot be compared.