Expression lists
Description
An expression list is a combination of expressions, and can appear in membership and comparison conditions (WHERE clauses) and in GROUP BY clauses. (Redshift SQL Language Reference Expression lists).
This syntax is fully supported in Snowflake.
Grammar Syntax
expression , expression , ... | (expression, expression, ...)Sample Source Patterns
Setup data
CREATE TABLE table1 (
quantity VARCHAR(50),
fruit VARCHAR(50)
);
CREATE TABLE table2 (
quantity VARCHAR(50),
fruit VARCHAR(50)
);
CREATE TABLE table3 (
id INT,
name VARCHAR(50),
quantity INT,
fruit VARCHAR(50),
price INT
);
INSERT INTO table1 (quantity, fruit)
VALUES
('one', 'apple'),
('two', 'banana'),
('three', 'cherry');
INSERT INTO table2 (quantity, fruit)
VALUES
('one', 'apple'),
('two', 'banana'),
('four', 'orange');
INSERT INTO table3 (id, name, quantity, fruit, price)
VALUES
(1, 'Alice', 1, 'apple', 100),
(2, 'Bob', 5, 'banana', 200),
(3, 'Charlie', 10, 'cherry', 300),
(4, 'David', 15, 'orange', 400);IN Clause
Input Code:
1
Alice
1
apple
100
2
Bob
5
banana
200
3
Charlie
10
cherry
300
Output Code:
1
Alice
1
apple
100
2
Bob
5
banana
200
3
Charlie
10
cherry
300
Comparisons
Input Code:
1
Alice
1
apple
100
Output Code:
1
Alice
1
apple
100
Input Code:
FALSE
FALSE
NULL
NULL
FALSE
Output Code:
FALSE
FALSE
NULL
NULL
FALSE
Nested tuples
Input Code:
1
Alice
1
apple
100
2
Bob
5
banana
200
3
Charlie
10
cherry
300
Output Code
1
Alice
1
apple
100
2
Bob
5
banana
200
3
Charlie
10
cherry
300
Case statement
Input Code:
Found
Found
Found
Not Found
Not Found
Not Found
Output Code
Found
Found
Found
Not Found
Not Found
Not Found
Multiple Expressions
Input Code:
1
Alice
1
apple
100
2
Bob
5
banana
200
3
Charlie
10
cherry
300
Output Code
1
Alice
1
apple
100
2
Bob
5
banana
200
3
Charlie
10
cherry
300
Joins
Input Code:
one
apple
one
apple
Output Code
one
apple
one
apple
Known Issues
No issues were found.
Related EWIs
There are no known issues.
Last updated
