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 SQLSelectstatement.
-
-
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 voidaccept(SelectVisitor visitor)Accept a visitor (e.g.Selectall()Add a wildcard field for all involved fields.SelectarithmeticExpression(BinaryArithmeticExpression arithmeticExpression)Deprecated.please use avalueExpression(ValueExpression)valueExpression} method instead.SelectarithmeticExpression(BinaryArithmeticExpression arithmeticExpression, String derivedColumnName)Deprecated.please use avalueExpression(ValueExpression, String)valueExpression} method instead.Selectfield(String... names)Add one or more named fields.FromClausefrom()Get theFromClauseof this select statement.Selectfunction(Function function)Add a function.Selectfunction(FunctionName functionName, ValueExpression... valueExpressions)Add a function.Selectfunction(FunctionName functionName, String derivedColumnName, ValueExpression... valueExpressions)Add a function.Selectfunction(Function function, String derivedColumnName)Add a function.GroupByClausegroupBy(ColumnReference... columnReferences)Create a newGroupByClause.Selectlimit(int count)Create a new full outerLimitClause.Selectlimit(int offset, int count)Create a new full outerLimitClause.OrderByClauseorderBy(ColumnReference... columnReferences)Create a newOrderByClause.Selectudf(String functionName, ColumnsDefinition emitsColumnsDefinition, ValueExpression... valueExpressions)Add a User Defined Function.Selectudf(String functionName, ValueExpression... valueExpressions)Add a User Defined Function.SelectvalueExpression(ValueExpression valueExpression)Add a value expression.SelectvalueExpression(ValueExpression valueExpression, String derivedColumnName)Add a value expression expression.Selectwhere(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:
thisinstance for fluent programming
-
field
public Select field(String... names)
Add one or more named fields.- Parameters:
names- field name- Returns:
thisinstance 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:
thisinstance 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:
thisinstance 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:
thisinstance for fluent programming
-
function
public Select function(Function function)
Add a function.- Parameters:
function- function- Returns:
thisinstance 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:
thisinstance 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:
thisinstance 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:
thisinstance 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:
thisinstance for fluent programming
-
valueExpression
public Select valueExpression(ValueExpression valueExpression)
Add a value expression.- Parameters:
valueExpression- value expression- Returns:
thisinstance 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:
thisinstance for fluent programming
-
from
public FromClause from()
Get theFromClauseof 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:
thisfor 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:
thisfor 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:
thisfor fluent programming
-
groupBy
public GroupByClause groupBy(ColumnReference... columnReferences)
Create a newGroupByClause.- Parameters:
columnReferences- column references- Returns:
GroupByClauseinstance
-
orderBy
public OrderByClause orderBy(ColumnReference... columnReferences)
Create a newOrderByClause.- Parameters:
columnReferences- column references- Returns:
OrderByClauseinstance
-
accept
public void accept(SelectVisitor visitor)
Description copied from interface:SelectFragmentAccept a visitor (e.g. a renderer or validator)- Specified by:
acceptin interfaceSelectFragment- Parameters:
visitor- visitor to accept
-
-