Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e98f964
commit 5451cf5
Showing
9 changed files
with
2,940 additions
and
79 deletions.
There are no files selected for viewing
287 changes: 287 additions & 0 deletions
287
sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/binaryComparison.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,287 @@ | ||
-- | ||
-- Licensed to the Apache Software Foundation (ASF) under one or more | ||
-- contributor license agreements. See the NOTICE file distributed with | ||
-- this work for additional information regarding copyright ownership. | ||
-- The ASF licenses this file to You under the Apache License, Version 2.0 | ||
-- (the "License"); you may not use this file except in compliance with | ||
-- the License. You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
|
||
-- Binary Comparison | ||
|
||
CREATE TEMPORARY VIEW t AS SELECT 1; | ||
|
||
SELECT cast(1 as binary) = '1' FROM t; | ||
SELECT cast(1 as binary) > '2' FROM t; | ||
SELECT cast(1 as binary) >= '2' FROM t; | ||
SELECT cast(1 as binary) < '2' FROM t; | ||
SELECT cast(1 as binary) <= '2' FROM t; | ||
SELECT cast(1 as binary) <> '2' FROM t; | ||
SELECT cast(1 as binary) = cast(null as string) FROM t; | ||
SELECT cast(1 as binary) > cast(null as string) FROM t; | ||
SELECT cast(1 as binary) >= cast(null as string) FROM t; | ||
SELECT cast(1 as binary) < cast(null as string) FROM t; | ||
SELECT cast(1 as binary) <= cast(null as string) FROM t; | ||
SELECT cast(1 as binary) <> cast(null as string) FROM t; | ||
SELECT '1' = cast(1 as binary) FROM t; | ||
SELECT '2' > cast(1 as binary) FROM t; | ||
SELECT '2' >= cast(1 as binary) FROM t; | ||
SELECT '2' < cast(1 as binary) FROM t; | ||
SELECT '2' <= cast(1 as binary) FROM t; | ||
SELECT '2' <> cast(1 as binary) FROM t; | ||
SELECT cast(null as string) = cast(1 as binary) FROM t; | ||
SELECT cast(null as string) > cast(1 as binary) FROM t; | ||
SELECT cast(null as string) >= cast(1 as binary) FROM t; | ||
SELECT cast(null as string) < cast(1 as binary) FROM t; | ||
SELECT cast(null as string) <= cast(1 as binary) FROM t; | ||
SELECT cast(null as string) <> cast(1 as binary) FROM t; | ||
SELECT cast(1 as tinyint) = '1' FROM t; | ||
SELECT cast(1 as tinyint) > '2' FROM t; | ||
SELECT cast(1 as tinyint) >= '2' FROM t; | ||
SELECT cast(1 as tinyint) < '2' FROM t; | ||
SELECT cast(1 as tinyint) <= '2' FROM t; | ||
SELECT cast(1 as tinyint) <> '2' FROM t; | ||
SELECT cast(1 as tinyint) = cast(null as string) FROM t; | ||
SELECT cast(1 as tinyint) > cast(null as string) FROM t; | ||
SELECT cast(1 as tinyint) >= cast(null as string) FROM t; | ||
SELECT cast(1 as tinyint) < cast(null as string) FROM t; | ||
SELECT cast(1 as tinyint) <= cast(null as string) FROM t; | ||
SELECT cast(1 as tinyint) <> cast(null as string) FROM t; | ||
SELECT '1' = cast(1 as tinyint) FROM t; | ||
SELECT '2' > cast(1 as tinyint) FROM t; | ||
SELECT '2' >= cast(1 as tinyint) FROM t; | ||
SELECT '2' < cast(1 as tinyint) FROM t; | ||
SELECT '2' <= cast(1 as tinyint) FROM t; | ||
SELECT '2' <> cast(1 as tinyint) FROM t; | ||
SELECT cast(null as string) = cast(1 as tinyint) FROM t; | ||
SELECT cast(null as string) > cast(1 as tinyint) FROM t; | ||
SELECT cast(null as string) >= cast(1 as tinyint) FROM t; | ||
SELECT cast(null as string) < cast(1 as tinyint) FROM t; | ||
SELECT cast(null as string) <= cast(1 as tinyint) FROM t; | ||
SELECT cast(null as string) <> cast(1 as tinyint) FROM t; | ||
SELECT cast(1 as smallint) = '1' FROM t; | ||
SELECT cast(1 as smallint) > '2' FROM t; | ||
SELECT cast(1 as smallint) >= '2' FROM t; | ||
SELECT cast(1 as smallint) < '2' FROM t; | ||
SELECT cast(1 as smallint) <= '2' FROM t; | ||
SELECT cast(1 as smallint) <> '2' FROM t; | ||
SELECT cast(1 as smallint) = cast(null as string) FROM t; | ||
SELECT cast(1 as smallint) > cast(null as string) FROM t; | ||
SELECT cast(1 as smallint) >= cast(null as string) FROM t; | ||
SELECT cast(1 as smallint) < cast(null as string) FROM t; | ||
SELECT cast(1 as smallint) <= cast(null as string) FROM t; | ||
SELECT cast(1 as smallint) <> cast(null as string) FROM t; | ||
SELECT '1' = cast(1 as smallint) FROM t; | ||
SELECT '2' > cast(1 as smallint) FROM t; | ||
SELECT '2' >= cast(1 as smallint) FROM t; | ||
SELECT '2' < cast(1 as smallint) FROM t; | ||
SELECT '2' <= cast(1 as smallint) FROM t; | ||
SELECT '2' <> cast(1 as smallint) FROM t; | ||
SELECT cast(null as string) = cast(1 as smallint) FROM t; | ||
SELECT cast(null as string) > cast(1 as smallint) FROM t; | ||
SELECT cast(null as string) >= cast(1 as smallint) FROM t; | ||
SELECT cast(null as string) < cast(1 as smallint) FROM t; | ||
SELECT cast(null as string) <= cast(1 as smallint) FROM t; | ||
SELECT cast(null as string) <> cast(1 as smallint) FROM t; | ||
SELECT cast(1 as int) = '1' FROM t; | ||
SELECT cast(1 as int) > '2' FROM t; | ||
SELECT cast(1 as int) >= '2' FROM t; | ||
SELECT cast(1 as int) < '2' FROM t; | ||
SELECT cast(1 as int) <= '2' FROM t; | ||
SELECT cast(1 as int) <> '2' FROM t; | ||
SELECT cast(1 as int) = cast(null as string) FROM t; | ||
SELECT cast(1 as int) > cast(null as string) FROM t; | ||
SELECT cast(1 as int) >= cast(null as string) FROM t; | ||
SELECT cast(1 as int) < cast(null as string) FROM t; | ||
SELECT cast(1 as int) <= cast(null as string) FROM t; | ||
SELECT cast(1 as int) <> cast(null as string) FROM t; | ||
SELECT '1' = cast(1 as int) FROM t; | ||
SELECT '2' > cast(1 as int) FROM t; | ||
SELECT '2' >= cast(1 as int) FROM t; | ||
SELECT '2' < cast(1 as int) FROM t; | ||
SELECT '2' <> cast(1 as int) FROM t; | ||
SELECT '2' <= cast(1 as int) FROM t; | ||
SELECT cast(null as string) = cast(1 as int) FROM t; | ||
SELECT cast(null as string) > cast(1 as int) FROM t; | ||
SELECT cast(null as string) >= cast(1 as int) FROM t; | ||
SELECT cast(null as string) < cast(1 as int) FROM t; | ||
SELECT cast(null as string) <> cast(1 as int) FROM t; | ||
SELECT cast(null as string) <= cast(1 as int) FROM t; | ||
SELECT cast(1 as bigint) = '1' FROM t; | ||
SELECT cast(1 as bigint) > '2' FROM t; | ||
SELECT cast(1 as bigint) >= '2' FROM t; | ||
SELECT cast(1 as bigint) < '2' FROM t; | ||
SELECT cast(1 as bigint) <= '2' FROM t; | ||
SELECT cast(1 as bigint) <> '2' FROM t; | ||
SELECT cast(1 as bigint) = cast(null as string) FROM t; | ||
SELECT cast(1 as bigint) > cast(null as string) FROM t; | ||
SELECT cast(1 as bigint) >= cast(null as string) FROM t; | ||
SELECT cast(1 as bigint) < cast(null as string) FROM t; | ||
SELECT cast(1 as bigint) <= cast(null as string) FROM t; | ||
SELECT cast(1 as bigint) <> cast(null as string) FROM t; | ||
SELECT '1' = cast(1 as bigint) FROM t; | ||
SELECT '2' > cast(1 as bigint) FROM t; | ||
SELECT '2' >= cast(1 as bigint) FROM t; | ||
SELECT '2' < cast(1 as bigint) FROM t; | ||
SELECT '2' <= cast(1 as bigint) FROM t; | ||
SELECT '2' <> cast(1 as bigint) FROM t; | ||
SELECT cast(null as string) = cast(1 as bigint) FROM t; | ||
SELECT cast(null as string) > cast(1 as bigint) FROM t; | ||
SELECT cast(null as string) >= cast(1 as bigint) FROM t; | ||
SELECT cast(null as string) < cast(1 as bigint) FROM t; | ||
SELECT cast(null as string) <= cast(1 as bigint) FROM t; | ||
SELECT cast(null as string) <> cast(1 as bigint) FROM t; | ||
SELECT cast(1 as decimal(10, 0)) = '1' FROM t; | ||
SELECT cast(1 as decimal(10, 0)) > '2' FROM t; | ||
SELECT cast(1 as decimal(10, 0)) >= '2' FROM t; | ||
SELECT cast(1 as decimal(10, 0)) < '2' FROM t; | ||
SELECT cast(1 as decimal(10, 0)) <> '2' FROM t; | ||
SELECT cast(1 as decimal(10, 0)) <= '2' FROM t; | ||
SELECT cast(1 as decimal(10, 0)) = cast(null as string) FROM t; | ||
SELECT cast(1 as decimal(10, 0)) > cast(null as string) FROM t; | ||
SELECT cast(1 as decimal(10, 0)) >= cast(null as string) FROM t; | ||
SELECT cast(1 as decimal(10, 0)) < cast(null as string) FROM t; | ||
SELECT cast(1 as decimal(10, 0)) <> cast(null as string) FROM t; | ||
SELECT cast(1 as decimal(10, 0)) <= cast(null as string) FROM t; | ||
SELECT '1' = cast(1 as decimal(10, 0)) FROM t; | ||
SELECT '2' > cast(1 as decimal(10, 0)) FROM t; | ||
SELECT '2' >= cast(1 as decimal(10, 0)) FROM t; | ||
SELECT '2' < cast(1 as decimal(10, 0)) FROM t; | ||
SELECT '2' <= cast(1 as decimal(10, 0)) FROM t; | ||
SELECT '2' <> cast(1 as decimal(10, 0)) FROM t; | ||
SELECT cast(null as string) = cast(1 as decimal(10, 0)) FROM t; | ||
SELECT cast(null as string) > cast(1 as decimal(10, 0)) FROM t; | ||
SELECT cast(null as string) >= cast(1 as decimal(10, 0)) FROM t; | ||
SELECT cast(null as string) < cast(1 as decimal(10, 0)) FROM t; | ||
SELECT cast(null as string) <= cast(1 as decimal(10, 0)) FROM t; | ||
SELECT cast(null as string) <> cast(1 as decimal(10, 0)) FROM t; | ||
SELECT cast(1 as double) = '1' FROM t; | ||
SELECT cast(1 as double) > '2' FROM t; | ||
SELECT cast(1 as double) >= '2' FROM t; | ||
SELECT cast(1 as double) < '2' FROM t; | ||
SELECT cast(1 as double) <= '2' FROM t; | ||
SELECT cast(1 as double) <> '2' FROM t; | ||
SELECT cast(1 as double) = cast(null as string) FROM t; | ||
SELECT cast(1 as double) > cast(null as string) FROM t; | ||
SELECT cast(1 as double) >= cast(null as string) FROM t; | ||
SELECT cast(1 as double) < cast(null as string) FROM t; | ||
SELECT cast(1 as double) <= cast(null as string) FROM t; | ||
SELECT cast(1 as double) <> cast(null as string) FROM t; | ||
SELECT '1' = cast(1 as double) FROM t; | ||
SELECT '2' > cast(1 as double) FROM t; | ||
SELECT '2' >= cast(1 as double) FROM t; | ||
SELECT '2' < cast(1 as double) FROM t; | ||
SELECT '2' <= cast(1 as double) FROM t; | ||
SELECT '2' <> cast(1 as double) FROM t; | ||
SELECT cast(null as string) = cast(1 as double) FROM t; | ||
SELECT cast(null as string) > cast(1 as double) FROM t; | ||
SELECT cast(null as string) >= cast(1 as double) FROM t; | ||
SELECT cast(null as string) < cast(1 as double) FROM t; | ||
SELECT cast(null as string) <= cast(1 as double) FROM t; | ||
SELECT cast(null as string) <> cast(1 as double) FROM t; | ||
SELECT cast(1 as float) = '1' FROM t; | ||
SELECT cast(1 as float) > '2' FROM t; | ||
SELECT cast(1 as float) >= '2' FROM t; | ||
SELECT cast(1 as float) < '2' FROM t; | ||
SELECT cast(1 as float) <= '2' FROM t; | ||
SELECT cast(1 as float) <> '2' FROM t; | ||
SELECT cast(1 as float) = cast(null as string) FROM t; | ||
SELECT cast(1 as float) > cast(null as string) FROM t; | ||
SELECT cast(1 as float) >= cast(null as string) FROM t; | ||
SELECT cast(1 as float) < cast(null as string) FROM t; | ||
SELECT cast(1 as float) <= cast(null as string) FROM t; | ||
SELECT cast(1 as float) <> cast(null as string) FROM t; | ||
SELECT '1' = cast(1 as float) FROM t; | ||
SELECT '2' > cast(1 as float) FROM t; | ||
SELECT '2' >= cast(1 as float) FROM t; | ||
SELECT '2' < cast(1 as float) FROM t; | ||
SELECT '2' <= cast(1 as float) FROM t; | ||
SELECT '2' <> cast(1 as float) FROM t; | ||
SELECT cast(null as string) = cast(1 as float) FROM t; | ||
SELECT cast(null as string) > cast(1 as float) FROM t; | ||
SELECT cast(null as string) >= cast(1 as float) FROM t; | ||
SELECT cast(null as string) < cast(1 as float) FROM t; | ||
SELECT cast(null as string) <= cast(1 as float) FROM t; | ||
SELECT cast(null as string) <> cast(1 as float) FROM t; | ||
-- the following queries return 1 if the search condition is satisfied | ||
-- and returns nothing if the search condition is not satisfied | ||
SELECT '1996-09-09' = date('1996-09-09') FROM t; | ||
SELECT '1996-9-10' > date('1996-09-09') FROM t; | ||
SELECT '1996-9-10' >= date('1996-09-09') FROM t; | ||
SELECT '1996-9-10' < date('1996-09-09') FROM t; | ||
SELECT '1996-9-10' <= date('1996-09-09') FROM t; | ||
SELECT '1996-9-10' <> date('1996-09-09') FROM t; | ||
SELECT cast(null as string) = date('1996-09-09') FROM t; | ||
SELECT cast(null as string)> date('1996-09-09') FROM t; | ||
SELECT cast(null as string)>= date('1996-09-09') FROM t; | ||
SELECT cast(null as string)< date('1996-09-09') FROM t; | ||
SELECT cast(null as string)<= date('1996-09-09') FROM t; | ||
SELECT cast(null as string)<> date('1996-09-09') FROM t; | ||
SELECT date('1996-09-09') = '1996-09-09' FROM t; | ||
SELECT date('1996-9-10') > '1996-09-09' FROM t; | ||
SELECT date('1996-9-10') >= '1996-09-09' FROM t; | ||
SELECT date('1996-9-10') < '1996-09-09' FROM t; | ||
SELECT date('1996-9-10') <= '1996-09-09' FROM t; | ||
SELECT date('1996-9-10') <> '1996-09-09' FROM t; | ||
SELECT date('1996-09-09') = cast(null as string) FROM t; | ||
SELECT date('1996-9-10') > cast(null as string) FROM t; | ||
SELECT date('1996-9-10') >= cast(null as string) FROM t; | ||
SELECT date('1996-9-10') < cast(null as string) FROM t; | ||
SELECT date('1996-9-10') <= cast(null as string) FROM t; | ||
SELECT date('1996-9-10') <> cast(null as string) FROM t; | ||
SELECT '1996-09-09 12:12:12.4' = timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT '1996-09-09 12:12:12.5' > timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT '1996-09-09 12:12:12.5' >= timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT '1996-09-09 12:12:12.5' < timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT '1996-09-09 12:12:12.5' <= timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT '1996-09-09 12:12:12.5' <> timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT cast(null as string) = timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT cast(null as string) > timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT cast(null as string) >= timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT cast(null as string) < timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT cast(null as string) <= timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT cast(null as string) <> timestamp('1996-09-09 12:12:12.4') FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.4' )= '1996-09-09 12:12:12.4' FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )> '1996-09-09 12:12:12.4' FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )>= '1996-09-09 12:12:12.4' FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )< '1996-09-09 12:12:12.4' FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )<= '1996-09-09 12:12:12.4' FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )<> '1996-09-09 12:12:12.4' FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.4' )= cast(null as string) FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )> cast(null as string) FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )>= cast(null as string) FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )< cast(null as string) FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )<= cast(null as string) FROM t; | ||
SELECT timestamp('1996-09-09 12:12:12.5' )<> cast(null as string) FROM t; | ||
SELECT ' ' = X'0020' FROM t; | ||
SELECT ' ' > X'001F' FROM t; | ||
SELECT ' ' >= X'001F' FROM t; | ||
SELECT ' ' < X'001F' FROM t; | ||
SELECT ' ' <= X'001F' FROM t; | ||
SELECT ' ' <> X'001F' FROM t; | ||
SELECT cast(null as string) = X'0020' FROM t; | ||
SELECT cast(null as string) > X'001F' FROM t; | ||
SELECT cast(null as string) >= X'001F' FROM t; | ||
SELECT cast(null as string) < X'001F' FROM t; | ||
SELECT cast(null as string) <= X'001F' FROM t; | ||
SELECT cast(null as string) <> X'001F' FROM t; | ||
SELECT X'0020' = ' ' FROM t; | ||
SELECT X'001F' > ' ' FROM t; | ||
SELECT X'001F' >= ' ' FROM t; | ||
SELECT X'001F' < ' ' FROM t; | ||
SELECT X'001F' <= ' ' FROM t; | ||
SELECT X'001F' <> ' ' FROM t; | ||
SELECT X'0020' = cast(null as string) FROM t; | ||
SELECT X'001F' > cast(null as string) FROM t; | ||
SELECT X'001F' >= cast(null as string) FROM t; | ||
SELECT X'001F' < cast(null as string) FROM t; | ||
SELECT X'001F' <= cast(null as string) FROM t; | ||
SELECT X'001F' <> cast(null as string) FROM t; |
72 changes: 72 additions & 0 deletions
72
sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/implicitTypeCasts.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
-- | ||
-- Licensed to the Apache Software Foundation (ASF) under one or more | ||
-- contributor license agreements. See the NOTICE file distributed with | ||
-- this work for additional information regarding copyright ownership. | ||
-- The ASF licenses this file to You under the Apache License, Version 2.0 | ||
-- (the "License"); you may not use this file except in compliance with | ||
-- the License. You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
-- | ||
|
||
-- ImplicitTypeCasts | ||
|
||
CREATE TEMPORARY VIEW t AS SELECT 1; | ||
|
||
SELECT 1 + '2' FROM t; | ||
SELECT 1 - '2' FROM t; | ||
SELECT 1 * '2' FROM t; | ||
SELECT 4 / '2' FROM t; | ||
SELECT 1.1 + '2' FROM t; | ||
SELECT 1.1 - '2' FROM t; | ||
SELECT 1.1 * '2' FROM t; | ||
SELECT 4.4 / '2' FROM t; | ||
SELECT 1.1 + '2.2' FROM t; | ||
SELECT 1.1 - '2.2' FROM t; | ||
SELECT 1.1 * '2.2' FROM t; | ||
SELECT 4.4 / '2.2' FROM t; | ||
|
||
-- concatentation | ||
SELECT '$' || cast(1 as smallint) || '$' FROM t; | ||
SELECT '$' || 1 || '$' FROM t; | ||
SELECT '$' || cast(1 as bigint) || '$' FROM t; | ||
SELECT '$' || cast(1.1 as float) || '$' FROM t; | ||
SELECT '$' || cast(1.1 as double) || '$' FROM t; | ||
SELECT '$' || 1.1 || '$' FROM t; | ||
SELECT '$' || cast(1.1 as decimal(8,3)) || '$' FROM t; | ||
SELECT '$' || 'abcd' || '$' FROM t; | ||
SELECT '$' || date('1996-09-09') || '$' FROM t; | ||
SELECT '$' || timestamp('1996-09-09 10:11:12.4' )|| '$' FROM t; | ||
|
||
-- length functions | ||
SELECT length(cast(1 as smallint)) FROM t; | ||
SELECT length(cast(1 as int)) FROM t; | ||
SELECT length(cast(1 as bigint)) FROM t; | ||
SELECT length(cast(1.1 as float)) FROM t; | ||
SELECT length(cast(1.1 as double)) FROM t; | ||
SELECT length(1.1) FROM t; | ||
SELECT length(cast(1.1 as decimal(8,3))) FROM t; | ||
SELECT length('four') FROM t; | ||
SELECT length(date('1996-09-10')) FROM t; | ||
SELECT length(timestamp('1996-09-10 10:11:12.4')) FROM t; | ||
|
||
-- extract | ||
SELECT year( '1996-01-10') FROM t; | ||
SELECT month( '1996-01-10') FROM t; | ||
SELECT day( '1996-01-10') FROM t; | ||
SELECT hour( '10:11:12') FROM t; | ||
SELECT minute( '10:11:12') FROM t; | ||
SELECT second( '10:11:12') FROM t; | ||
|
||
-- like | ||
select 1 like '%' FROM t; | ||
select date('1996-09-10') like '19%' FROM t; | ||
select '1' like 1 FROM t; | ||
select '1 ' like 1 FROM t; | ||
select '1996-09-10' like date('1996-09-10') FROM t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.