Package com.exasol.sql.dql.select
Class Select
- java.lang.Object
-
- com.exasol.sql.AbstractFragment
-
- com.exasol.sql.dql.select.Select
-
- All Implemented Interfaces:
SelectFragment
,Fragment
,SqlStatement
public class Select extends AbstractFragment implements SqlStatement, SelectFragment
This class implements an SQLSelect
statement.
-
-
Field Summary
-
Fields inherited from class com.exasol.sql.AbstractFragment
root
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
accept(SelectVisitor visitor)
Accept a visitor (e.g.Select
all()
Add a wildcard field for all involved fields.Select
arithmeticExpression(BinaryArithmeticExpression arithmeticExpression)
Deprecated.please use avalueExpression(ValueExpression)
valueExpression} method instead.Select
arithmeticExpression(BinaryArithmeticExpression arithmeticExpression, String derivedColumnName)
Deprecated.please use avalueExpression(ValueExpression, String)
valueExpression} method instead.Select
field(String... names)
Add one or more named fields.FromClause
from()
Get theFromClause
of this select statement.Select
function(Function function)
Add a function.Select
function(FunctionName functionName, ValueExpression... valueExpressions)
Add a function.Select
function(FunctionName functionName, String derivedColumnName, ValueExpression... valueExpressions)
Add a function.Select
function(Function function, String derivedColumnName)
Add a function.GroupByClause
groupBy(ColumnReference... columnReferences)
Create a newGroupByClause
.Select
limit(int count)
Create a new full outerLimitClause
.Select
limit(int offset, int count)
Create a new full outerLimitClause
.OrderByClause
orderBy(ColumnReference... columnReferences)
Create a newOrderByClause
.Select
udf(String functionName, ColumnsDefinition emitsColumnsDefinition, ValueExpression... valueExpressions)
Add a User Defined Function.Select
udf(String functionName, ValueExpression... valueExpressions)
Add a User Defined Function.Select
valueExpression(ValueExpression valueExpression)
Add a value expression.Select
valueExpression(ValueExpression valueExpression, String derivedColumnName)
Add a value expression expression.Select
where(BooleanExpression expression)
Create a newWhereClause
.-
Methods inherited from class com.exasol.sql.AbstractFragment
getRoot
-
-
-
-
Constructor Detail
-
Select
public Select()
Create a new instance of aSelect
.
-
-
Method Detail
-
all
public Select all()
Add a wildcard field for all involved fields.- Returns:
this
instance for fluent programming
-
field
public Select field(String... names)
Add one or more named fields.- Parameters:
names
- field name- Returns:
this
instance for fluent programming
-
function
public Select function(FunctionName functionName, ValueExpression... valueExpressions)
Add a function.- Parameters:
functionName
- name of functionvalueExpressions
- zero or more value expression- Returns:
this
instance for fluent programming
-
function
public Select function(FunctionName functionName, String derivedColumnName, ValueExpression... valueExpressions)
Add a function.- Parameters:
functionName
- name of the functionvalueExpressions
- zero or more value expressionderivedColumnName
- name under which you can refer to the derived column- Returns:
this
instance for fluent programming
-
function
public Select function(Function function, String derivedColumnName)
Add a function.- Parameters:
function
- functionderivedColumnName
- name under which you can refer to the derived column- Returns:
this
instance for fluent programming
-
function
public Select function(Function function)
Add a function.- Parameters:
function
- function- Returns:
this
instance for fluent programming
-
udf
public Select udf(String functionName, ColumnsDefinition emitsColumnsDefinition, ValueExpression... valueExpressions)
Add a User Defined Function.- Parameters:
functionName
- name of functionemitsColumnsDefinition
- column definitions for emitsvalueExpressions
- zero or more value expressions- Returns:
this
instance for fluent programming
-
udf
public Select udf(String functionName, ValueExpression... valueExpressions)
Add a User Defined Function.- Parameters:
functionName
- a name of functionvalueExpressions
- zero or more value expressions- Returns:
this
instance for fluent programming
-
arithmeticExpression
@Deprecated(since="4.0.2") public Select arithmeticExpression(BinaryArithmeticExpression arithmeticExpression)
Deprecated.please use avalueExpression(ValueExpression)
valueExpression} method instead.Add an arithmetic expression.- Parameters:
arithmeticExpression
- arithmetic expression- Returns:
this
instance for fluent programming
-
arithmeticExpression
@Deprecated(since="4.0.2") public Select arithmeticExpression(BinaryArithmeticExpression arithmeticExpression, String derivedColumnName)
Deprecated.please use avalueExpression(ValueExpression, String)
valueExpression} method instead.Add an arithmetic expression.- Parameters:
arithmeticExpression
- arithmetic expressionderivedColumnName
- name under which you can refer to the derived column- Returns:
this
instance for fluent programming
-
valueExpression
public Select valueExpression(ValueExpression valueExpression)
Add a value expression.- Parameters:
valueExpression
- value expression- Returns:
this
instance for fluent programming
-
valueExpression
public Select valueExpression(ValueExpression valueExpression, String derivedColumnName)
Add a value expression expression.- Parameters:
valueExpression
- value expressionderivedColumnName
- name under which you can refer to the derived column- Returns:
this
instance for fluent programming
-
from
public FromClause from()
Get theFromClause
of this select statement.- Returns:
- from clause
-
limit
public Select limit(int count)
Create a new full outerLimitClause
.- Parameters:
count
- maximum number of rows to be included in query result- Returns:
this
for fluent programming- Throws:
IllegalStateException
- if a limit clause already exists
-
limit
public Select limit(int offset, int count)
Create a new full outerLimitClause
.- Parameters:
offset
- index of the first row in the query resultcount
- maximum number of rows to be included in query result- Returns:
this
for fluent programming- Throws:
IllegalStateException
- if a limit clause already exists
-
where
public Select where(BooleanExpression expression)
Create a newWhereClause
.- Parameters:
expression
- boolean expression that defines the filter criteria- Returns:
this
for fluent programming
-
groupBy
public GroupByClause groupBy(ColumnReference... columnReferences)
Create a newGroupByClause
.- Parameters:
columnReferences
- column references- Returns:
GroupByClause
instance
-
orderBy
public OrderByClause orderBy(ColumnReference... columnReferences)
Create a newOrderByClause
.- Parameters:
columnReferences
- column references- Returns:
OrderByClause
instance
-
accept
public void accept(SelectVisitor visitor)
Description copied from interface:SelectFragment
Accept a visitor (e.g. a renderer or validator)- Specified by:
accept
in interfaceSelectFragment
- Parameters:
visitor
- visitor to accept
-
-