Package com.querydsl.sql
Class SQLExpressions
java.lang.Object
com.querydsl.sql.SQLExpressions
Common SQL expressions
- Author:
- tiwe
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Expression<Object[]>Wildcard expressionstatic final Expression<Long>Wildcard count expression -
Method Summary
Modifier and TypeMethodDescriptionstatic <D extends Comparable>
DateExpression<D>addDays(DateExpression<D> date, int days) Add the given amount of days to the datestatic <D extends Comparable>
DateTimeExpression<D>addDays(DateTimeExpression<D> date, int days) Add the given amount of days to the datestatic <D extends Comparable>
DateTimeExpression<D>addHours(DateTimeExpression<D> date, int hours) Add the given amount of hours to the datestatic <D extends Comparable>
DateTimeExpression<D>addMinutes(DateTimeExpression<D> date, int minutes) Add the given amount of minutes to the datestatic <D extends Comparable>
DateExpression<D>addMonths(DateExpression<D> date, int months) Add the given amount of months to the datestatic <D extends Comparable>
DateTimeExpression<D>addMonths(DateTimeExpression<D> date, int months) Add the given amount of months to the datestatic <D extends Comparable>
DateTimeExpression<D>addSeconds(DateTimeExpression<D> date, int seconds) Add the given amount of seconds to the datestatic <D extends Comparable>
DateExpression<D>addWeeks(DateExpression<D> date, int weeks) Add the given amount of weeks to the datestatic <D extends Comparable>
DateTimeExpression<D>addWeeks(DateTimeExpression<D> date, int weeks) Add the given amount of weeks to the datestatic <D extends Comparable>
DateExpression<D>addYears(DateExpression<D> date, int years) Add the given amount of years to the datestatic <D extends Comparable>
DateTimeExpression<D>addYears(DateTimeExpression<D> date, int years) Add the given amount of years to the datestatic BooleanExpressionall(BooleanExpression expr) Get an aggregate all expression for the given boolean expressionstatic BooleanExpressionany(BooleanExpression expr) Get an aggregate any expression for the given boolean expressionstatic <T extends Number>
WindowOver<T>avg(Expression<T> expr) Start a window function expressionstatic WindowOver<Double>corr(Expression<? extends Number> expr1, Expression<? extends Number> expr2) CORR returns the coefficient of correlation of a set of number pairs.static WindowOver<Long>count()Start a window function expressionstatic WindowOver<Long>count(Expression<?> expr) Start a window function expressionstatic WindowOver<Long>countDistinct(Expression<?> expr) Start a window function expressionstatic WindowOver<Double>covarPop(Expression<? extends Number> expr1, Expression<? extends Number> expr2) CORR returns the coefficient of correlation of a set of number pairs.static WindowOver<Double>covarSamp(Expression<? extends Number> expr1, Expression<? extends Number> expr2) CORR returns the coefficient of correlation of a set of number pairs.static WindowOver<Double>cumeDist()CUME_DIST calculates the cumulative distribution of a value in a group of values.static WithinGroup<Double>cumeDist(Expression<?>... args) As an aggregate function, CUME_DIST calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the relative position of row r among the rows in the aggregation group.static WithinGroup<Double>As an aggregate function, CUME_DIST calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the relative position of row r among the rows in the aggregation group.static <D extends Comparable>
DateExpression<D>date(DateTimeExpression<D> dateTime) Convert timestamp to datestatic <D extends Comparable>
DateExpression<D>date(Class<D> type, DateTimeExpression<?> dateTime) Convert timestamp to datestatic <D extends Comparable>
DateExpression<D>dateadd(DatePart unit, DateExpression<D> date, int amount) Create a dateadd(unit, date, amount) expressionstatic <D extends Comparable>
DateTimeExpression<D>dateadd(DatePart unit, DateTimeExpression<D> date, int amount) Create a dateadd(unit, date, amount) expressionstatic <D extends Comparable>
NumberExpression<Integer>datediff(DatePart unit, DateExpression<D> start, DateExpression<D> end) Get a datediff(unit, start, end) expressionstatic <D extends Comparable>
NumberExpression<Integer>datediff(DatePart unit, DateExpression<D> start, D end) Get a datediff(unit, start, end) expressionstatic <D extends Comparable>
NumberExpression<Integer>datediff(DatePart unit, DateTimeExpression<D> start, DateTimeExpression<D> end) Get a datediff(unit, start, end) expressionstatic <D extends Comparable>
NumberExpression<Integer>datediff(DatePart unit, DateTimeExpression<D> start, D end) Get a datediff(unit, start, end) expressionstatic <D extends Comparable>
NumberExpression<Integer>datediff(DatePart unit, D start, DateExpression<D> end) Get a datediff(unit, start, end) expressionstatic <D extends Comparable>
NumberExpression<Integer>datediff(DatePart unit, D start, DateTimeExpression<D> end) Get a datediff(unit, start, end) expressionstatic <D extends Comparable>
DateExpression<D>datetrunc(DatePart unit, DateExpression<D> expr) Truncate the given date expressionstatic <D extends Comparable>
DateTimeExpression<D>datetrunc(DatePart unit, DateTimeExpression<D> expr) Truncate the given datetime expressionstatic WindowOver<Long>rank of the current row without gaps; this function counts peer groupsstatic WithinGroup<Long>denseRank(Expression<?>... args) As an aggregate function, DENSE_RANK calculates the dense rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification.static WithinGroup<Long>As an aggregate function, DENSE_RANK calculates the dense rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification.static <T> WindowOver<T>firstValue(Expression<T> expr) returns value evaluated at the row that is the first row of the window framestatic StringExpressiongroupConcat(Expression<String> expr) Get a group_concat(expr) expressionstatic StringExpressiongroupConcat(Expression<String> expr, String separator) Get a group_concat(expr, separator) expressionstatic <T> WindowOver<T>lag(Expression<T> expr) expr evaluated at the row that is one row before the current row within the partitionstatic <T> WindowOver<T>lastValue(Expression<T> expr) returns value evaluated at the row that is the last row of the window framestatic <T> WindowOver<T>lead(Expression<T> expr) expr evaluated at the row that is one row after the current row within the partition;static StringExpressionleft(Expression<String> lhs, int rhs) Get the rhs leftmost characters of lhsstatic StringExpressionleft(Expression<String> lhs, Expression<Integer> rhs) Get the rhs leftmost characters of lhsstatic WithinGroup<String>listagg(Expression<?> expr, String delimiter) LISTAGG orders data within each group specified in the ORDER BY clause and then concatenates the values of the measure column.static <T extends Comparable>
WindowOver<T>max(Expression<T> expr) Start a window function expressionstatic <T extends Comparable>
WindowOver<T>min(Expression<T> expr) Start a window function expressionstatic <T extends Number>
SimpleExpression<T>Create a nextval(sequence) expression of the given typestatic SimpleExpression<Long>Create a nextval(sequence) expressionstatic <T> WindowOver<T>nthValue(Expression<T> expr, Expression<? extends Number> n) NTH_VALUE returns the expr value of the nth row in the window defined by the analytic clause.static <T> WindowOver<T>nthValue(Expression<T> expr, Number n) NTH_VALUE returns the expr value of the nth row in the window defined by the analytic clause.static <T extends Number & Comparable>
WindowOver<T>ntile(T num) divides an ordered data set into a number of buckets indicated by expr and assigns the appropriate bucket number to each rowstatic <T extends Number>
WithinGroup<T>percentileCont(Expression<T> arg) Calculates a percentile based on a continuous distribution of the column valuestatic <T extends Number>
WithinGroup<T>percentileCont(T arg) Calculates a percentile based on a continuous distribution of the column valuestatic <T extends Number>
WithinGroup<T>percentileDisc(Expression<T> arg) PERCENTILE_DISC is an inverse distribution function that assumes a discrete distribution model.static <T extends Number>
WithinGroup<T>percentileDisc(T arg) PERCENTILE_DISC is an inverse distribution function that assumes a discrete distribution model.static WindowOver<Double>As an analytic function, for a row r, PERCENT_RANK calculates the rank of r minus 1, divided by 1 less than the number of rows being evaluated (the entire query result set or a partition).static WithinGroup<Double>percentRank(Expression<?>... args) As an aggregate function, PERCENT_RANK calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the rank of row r minus 1 divided by the number of rows in the aggregate group.static WithinGroup<Double>percentRank(Object... args) As an aggregate function, PERCENT_RANK calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the rank of row r minus 1 divided by the number of rows in the aggregate group.static WindowOver<Long>rank()rank of the current row with gaps; same as row_number of its first peerstatic WithinGroup<Long>rank(Expression<?>... args) As an aggregate function, RANK calculates the rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification.static WithinGroup<Long>As an aggregate function, RANK calculates the rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification.static <T> WindowOver<T>ratioToReport(Expression<T> expr) computes the ratio of a value to the sum of a set of values.static WindowOver<Double>regrAvgx(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_AVGX evaluates the average of the independent variable (arg2) of the regression line.static WindowOver<Double>regrAvgy(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_AVGY evaluates the average of the dependent variable (arg1) of the regression line.static WindowOver<Double>regrCount(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_COUNT returns an integer that is the number of non-null number pairs used to fit the regression line.static WindowOver<Double>regrIntercept(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_INTERCEPT returns the y-intercept of the regression line.static WindowOver<Double>regrR2(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_R2 returns the coefficient of determination (also called R-squared or goodness of fit) for the regression.static WindowOver<Double>regrSlope(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_SLOPE returns the slope of the linestatic WindowOver<Double>regrSxx(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_SXX makes the following computation after the elimination of null (arg1, arg2) pairs:static WindowOver<Double>regrSxy(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_SXY makes the following computation after the elimination of null (arg1, arg2) pairs:static WindowOver<Double>regrSyy(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_SYY makes the following computation after the elimination of null (arg1, arg2) pairs:static <T> RelationalFunctionCall<T>relationalFunctionCall(Class<? extends T> type, String function, Object... args) Create a new RelationalFunctionCall for the given function and argumentsstatic StringExpressionright(Expression<String> lhs, int rhs) Get the rhs rightmost characters of lhsstatic StringExpressionright(Expression<String> lhs, Expression<Integer> rhs) Get the rhs leftmost characters of lhsstatic WindowOver<Long>number of the current row within its partition, counting from 1select(Expression<?>... exprs) Create a new detached SQLQuery instance with the given projectionstatic <T> SQLQuery<T>select(Expression<T> expr) Create a new detached SQLQuery instance with the given projectionselectDistinct(Expression<?>... exprs) Create a new detached SQLQuery instance with the given projectionstatic <T> SQLQuery<T>selectDistinct(Expression<T> expr) Create a new detached SQLQuery instance with the given projectionstatic <T> SQLQuery<T>selectFrom(RelationalPath<T> expr) Create a new detached SQLQuery instance with the given projectionCreate a new detached SQLQuery instance with one as the projectionCreate a new detached SQLQuery instance with zero as the projectionstatic <T> Expression<T>set(Path<T> target, Expression<? extends T> value) Create an assignment expressionstatic <T> Expression<T>Create an assignment expressionstatic <T extends Number>
WindowOver<T>stddev(Expression<T> expr) returns the sample standard deviation of expr, a set of numbers.static <T extends Number>
WindowOver<T>stddevDistinct(Expression<T> expr) returns the sample standard deviation of expr, a set of numbers.static <T extends Number>
WindowOver<T>stddevPop(Expression<T> expr) returns the population standard deviation and returns the square root of the population variance.static <T extends Number>
WindowOver<T>stddevSamp(Expression<T> expr) returns the cumulative sample standard deviation and returns the square root of the sample variance.static <T extends Number>
WindowOver<T>sum(Expression<T> expr) Start a window function expressionstatic <T> Union<T>union(SubQueryExpression<T>... sq) Create a new UNION clausestatic <T> Union<T>union(List<SubQueryExpression<T>> sq) Create a new UNION clausestatic <T> Union<T>unionAll(SubQueryExpression<T>... sq) Create a new UNION ALL clausestatic <T> Union<T>unionAll(List<SubQueryExpression<T>> sq) Create a new UNION ALL clausestatic <T extends Number>
WindowOver<T>variance(Expression<T> expr) returns the variance of exprstatic <T extends Number>
WindowOver<T>varPop(Expression<T> expr) returns the population variance of a set of numbers after discarding the nulls in this set.static <T extends Number>
WindowOver<T>varSamp(Expression<T> expr) returns the sample variance of a set of numbers after discarding the nulls in this set.
-
Field Details
-
all
Wildcard expression -
countAll
Wildcard count expression
-
-
Method Details
-
set
Create an assignment expression- Type Parameters:
T-- Parameters:
target- target expressionvalue- value to be set- Returns:
- target = value
-
set
Create an assignment expression- Type Parameters:
T-- Parameters:
target- target expressionvalue- value to be set- Returns:
- target = value
-
select
Create a new detached SQLQuery instance with the given projection- Type Parameters:
T-- Parameters:
expr- projection- Returns:
- select(expr)
-
select
Create a new detached SQLQuery instance with the given projection- Parameters:
exprs- projection- Returns:
- select(exprs)
-
selectDistinct
Create a new detached SQLQuery instance with the given projection- Type Parameters:
T-- Parameters:
expr- distinct projection- Returns:
- select(distinct expr)
-
selectDistinct
Create a new detached SQLQuery instance with the given projection- Parameters:
exprs- distinct projection- Returns:
- select(distinct exprs)
-
selectZero
Create a new detached SQLQuery instance with zero as the projection- Returns:
- select(0)
-
selectOne
Create a new detached SQLQuery instance with one as the projection- Returns:
- select(1)
-
selectFrom
Create a new detached SQLQuery instance with the given projection- Type Parameters:
T-- Parameters:
expr- query source and projection- Returns:
- select(expr).from(expr)
-
union
Create a new UNION clause- Type Parameters:
T-- Parameters:
sq- subqueries- Returns:
- union
-
union
Create a new UNION clause- Type Parameters:
T-- Parameters:
sq- subqueries- Returns:
- union
-
unionAll
Create a new UNION ALL clause- Type Parameters:
T-- Parameters:
sq- subqueries- Returns:
- union
-
unionAll
Create a new UNION ALL clause- Type Parameters:
T-- Parameters:
sq- subqueries- Returns:
- union
-
any
Get an aggregate any expression for the given boolean expression -
all
Get an aggregate all expression for the given boolean expression -
relationalFunctionCall
public static <T> RelationalFunctionCall<T> relationalFunctionCall(Class<? extends T> type, String function, Object... args) Create a new RelationalFunctionCall for the given function and arguments- Type Parameters:
T-- Parameters:
type- typefunction- function nameargs- arguments- Returns:
- relational function call
-
nextval
Create a nextval(sequence) expressionReturns the next value from the give sequence
- Parameters:
sequence- sequence name- Returns:
- nextval(sequence)
-
nextval
Create a nextval(sequence) expression of the given typeReturns the next value from the given sequence
- Parameters:
type- type of callsequence- sequence name- Returns:
- nextval(sequence)
-
date
Convert timestamp to date- Parameters:
dateTime- timestamp- Returns:
- date
-
date
public static <D extends Comparable> DateExpression<D> date(Class<D> type, DateTimeExpression<?> dateTime) Convert timestamp to date- Parameters:
type- typedateTime- timestamp- Returns:
- date
-
dateadd
public static <D extends Comparable> DateTimeExpression<D> dateadd(DatePart unit, DateTimeExpression<D> date, int amount) Create a dateadd(unit, date, amount) expression- Parameters:
unit- date partdate- dateamount- amount- Returns:
- converted date
-
dateadd
public static <D extends Comparable> DateExpression<D> dateadd(DatePart unit, DateExpression<D> date, int amount) Create a dateadd(unit, date, amount) expression- Parameters:
unit- date partdate- dateamount- amount- Returns:
- converted date
-
datediff
public static <D extends Comparable> NumberExpression<Integer> datediff(DatePart unit, DateExpression<D> start, DateExpression<D> end) Get a datediff(unit, start, end) expression- Parameters:
unit- date partstart- startend- end- Returns:
- difference in units
-
datediff
public static <D extends Comparable> NumberExpression<Integer> datediff(DatePart unit, D start, DateExpression<D> end) Get a datediff(unit, start, end) expression- Parameters:
unit- date partstart- startend- end- Returns:
- difference in units
-
datediff
public static <D extends Comparable> NumberExpression<Integer> datediff(DatePart unit, DateExpression<D> start, D end) Get a datediff(unit, start, end) expression- Parameters:
unit- date partstart- startend- end- Returns:
- difference in units
-
datediff
public static <D extends Comparable> NumberExpression<Integer> datediff(DatePart unit, DateTimeExpression<D> start, DateTimeExpression<D> end) Get a datediff(unit, start, end) expression- Parameters:
unit- date partstart- startend- end- Returns:
- difference in units
-
datediff
public static <D extends Comparable> NumberExpression<Integer> datediff(DatePart unit, D start, DateTimeExpression<D> end) Get a datediff(unit, start, end) expression- Parameters:
unit- date partstart- startend- end- Returns:
- difference in units
-
datediff
public static <D extends Comparable> NumberExpression<Integer> datediff(DatePart unit, DateTimeExpression<D> start, D end) Get a datediff(unit, start, end) expression- Parameters:
unit- date partstart- startend- end- Returns:
- difference in units
-
datetrunc
public static <D extends Comparable> DateExpression<D> datetrunc(DatePart unit, DateExpression<D> expr) Truncate the given date expression- Parameters:
unit- date part to truncate toexpr- truncated date
-
datetrunc
public static <D extends Comparable> DateTimeExpression<D> datetrunc(DatePart unit, DateTimeExpression<D> expr) Truncate the given datetime expression- Parameters:
unit- datepart to truncate toexpr- truncated datetime
-
addYears
public static <D extends Comparable> DateTimeExpression<D> addYears(DateTimeExpression<D> date, int years) Add the given amount of years to the date- Parameters:
date- datetimeyears- years to add- Returns:
- converted datetime
-
addMonths
public static <D extends Comparable> DateTimeExpression<D> addMonths(DateTimeExpression<D> date, int months) Add the given amount of months to the date- Parameters:
date- datetimemonths- months to add- Returns:
- converted datetime
-
addWeeks
public static <D extends Comparable> DateTimeExpression<D> addWeeks(DateTimeExpression<D> date, int weeks) Add the given amount of weeks to the date- Parameters:
date- datetimeweeks- weeks to add- Returns:
- converted date
-
addDays
public static <D extends Comparable> DateTimeExpression<D> addDays(DateTimeExpression<D> date, int days) Add the given amount of days to the date- Parameters:
date- datetimedays- days to add- Returns:
- converted datetime
-
addHours
public static <D extends Comparable> DateTimeExpression<D> addHours(DateTimeExpression<D> date, int hours) Add the given amount of hours to the date- Parameters:
date- datetimehours- hours to add- Returns:
- converted datetime
-
addMinutes
public static <D extends Comparable> DateTimeExpression<D> addMinutes(DateTimeExpression<D> date, int minutes) Add the given amount of minutes to the date- Parameters:
date- datetimeminutes- minutes to add- Returns:
- converted datetime
-
addSeconds
public static <D extends Comparable> DateTimeExpression<D> addSeconds(DateTimeExpression<D> date, int seconds) Add the given amount of seconds to the date- Parameters:
date- datetimeseconds- seconds to add- Returns:
- converted datetime
-
addYears
Add the given amount of years to the date- Parameters:
date- dateyears- years to add- Returns:
- converted date
-
addMonths
public static <D extends Comparable> DateExpression<D> addMonths(DateExpression<D> date, int months) Add the given amount of months to the date- Parameters:
date- datemonths- months to add- Returns:
- converted date
-
addWeeks
Add the given amount of weeks to the date- Parameters:
date- dateweeks- weeks to add- Returns:
- converted date
-
addDays
Add the given amount of days to the date- Parameters:
date- datedays- days to add- Returns:
- converted date
-
sum
Start a window function expression- Parameters:
expr- expression- Returns:
- sum(expr)
-
count
Start a window function expression- Returns:
- count()
-
count
Start a window function expression- Parameters:
expr- expression- Returns:
- count(expr)
-
countDistinct
Start a window function expression- Parameters:
expr- expression- Returns:
- count(distinct expr)
-
avg
Start a window function expression- Parameters:
expr- expression- Returns:
- avg(expr)
-
min
Start a window function expression- Parameters:
expr- expression- Returns:
- min(expr)
-
max
Start a window function expression- Parameters:
expr- expression- Returns:
- max(expr)
-
lead
expr evaluated at the row that is one row after the current row within the partition;- Parameters:
expr- expression- Returns:
- lead(expr)
-
lag
expr evaluated at the row that is one row before the current row within the partition- Parameters:
expr- expression- Returns:
- lag(expr)
-
listagg
LISTAGG orders data within each group specified in the ORDER BY clause and then concatenates the values of the measure column.- Parameters:
expr- measure columndelimiter- delimiter- Returns:
- listagg(expr, delimiter)
-
nthValue
NTH_VALUE returns the expr value of the nth row in the window defined by the analytic clause. The returned value has the data type of the expr.- Parameters:
expr- measure expressionn- one based row index- Returns:
- nth_value(expr, n)
-
nthValue
NTH_VALUE returns the expr value of the nth row in the window defined by the analytic clause. The returned value has the data type of the expr- Parameters:
expr- measure expressionn- one based row index- Returns:
- nth_value(expr, n)
-
ntile
divides an ordered data set into a number of buckets indicated by expr and assigns the appropriate bucket number to each row- Parameters:
num- bucket size- Returns:
- ntile(num)
-
rank
rank of the current row with gaps; same as row_number of its first peer- Returns:
- rank()
-
rank
As an aggregate function, RANK calculates the rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row within each group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore, the number of arguments must be the same and their types must be compatible.- Parameters:
args- arguments- Returns:
- rank(args)
-
rank
As an aggregate function, RANK calculates the rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row within each group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore, the number of arguments must be the same and their types must be compatible.- Parameters:
args- arguments- Returns:
- rank(args)
-
denseRank
rank of the current row without gaps; this function counts peer groups- Returns:
- dense_rank()
-
denseRank
As an aggregate function, DENSE_RANK calculates the dense rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row within each group. The constant argument expressions and the expressions in the order_by_clause of the aggregate match by position. Therefore, the number of arguments must be the same and types must be compatible.- Parameters:
args- arguments- Returns:
- dense_rank(args)
-
denseRank
As an aggregate function, DENSE_RANK calculates the dense rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row within each group. The constant argument expressions and the expressions in the order_by_clause of the aggregate match by position. Therefore, the number of arguments must be the same and types must be compatible.- Parameters:
args- arguments- Returns:
- dense_rank(args)
-
percentRank
As an analytic function, for a row r, PERCENT_RANK calculates the rank of r minus 1, divided by 1 less than the number of rows being evaluated (the entire query result set or a partition).- Returns:
- percent_rank()
-
percentRank
As an aggregate function, PERCENT_RANK calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the rank of row r minus 1 divided by the number of rows in the aggregate group. This calculation is made as if the hypothetical row r were inserted into the group of rows over which Oracle Database is to aggregate. The arguments of the function identify a single hypothetical row within each aggregate group. Therefore, they must all evaluate to constant expressions within each aggregate group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore the number of arguments must be the same and their types must be compatible.- Parameters:
args- arguments- Returns:
- percent_rank(args)
-
percentRank
As an aggregate function, PERCENT_RANK calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the rank of row r minus 1 divided by the number of rows in the aggregate group. This calculation is made as if the hypothetical row r were inserted into the group of rows over which Oracle Database is to aggregate. The arguments of the function identify a single hypothetical row within each aggregate group. Therefore, they must all evaluate to constant expressions within each aggregate group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore the number of arguments must be the same and their types must be compatible.- Parameters:
args- arguments- Returns:
- percent_rank(args)
-
percentileCont
Calculates a percentile based on a continuous distribution of the column value- Parameters:
arg- argument- Returns:
- percentile_cont(arg)
-
percentileCont
Calculates a percentile based on a continuous distribution of the column value- Parameters:
arg- argument- Returns:
- percentile_cont(arg)
-
percentileDisc
PERCENTILE_DISC is an inverse distribution function that assumes a discrete distribution model. It takes a percentile value and a sort specification and returns an element from the set. Nulls are ignored in the calculation.This function takes as an argument any numeric datatype or any nonnumeric datatype that can be implicitly converted to a numeric datatype. The function returns the same datatype as the numeric datatype of the argument.
- Parameters:
arg- argument- Returns:
- percentile_disc(arg)
-
percentileDisc
PERCENTILE_DISC is an inverse distribution function that assumes a discrete distribution model. It takes a percentile value and a sort specification and returns an element from the set. Nulls are ignored in the calculation.This function takes as an argument any numeric datatype or any nonnumeric datatype that can be implicitly converted to a numeric datatype. The function returns the same datatype as the numeric datatype of the argument.
- Parameters:
arg- argument- Returns:
- percentile_disc(arg)
-
regrSlope
public static WindowOver<Double> regrSlope(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_SLOPE returns the slope of the line- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_slope(arg1, arg2)
-
regrIntercept
public static WindowOver<Double> regrIntercept(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_INTERCEPT returns the y-intercept of the regression line.- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_intercept(arg1, arg2)
-
regrCount
public static WindowOver<Double> regrCount(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_COUNT returns an integer that is the number of non-null number pairs used to fit the regression line.- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_count(arg1, arg2)
-
regrR2
public static WindowOver<Double> regrR2(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_R2 returns the coefficient of determination (also called R-squared or goodness of fit) for the regression.- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_r2(arg1, arg2)
-
regrAvgx
public static WindowOver<Double> regrAvgx(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_AVGX evaluates the average of the independent variable (arg2) of the regression line.- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_avgx(arg1, arg2)
-
regrAvgy
public static WindowOver<Double> regrAvgy(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_AVGY evaluates the average of the dependent variable (arg1) of the regression line.- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_avgy(arg1, arg2)
-
regrSxx
public static WindowOver<Double> regrSxx(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_SXX makes the following computation after the elimination of null (arg1, arg2) pairs:REGR_COUNT(arg1, arg2) * VAR_POP(arg2)- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_sxx(arg1, arg2)
-
regrSyy
public static WindowOver<Double> regrSyy(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_SYY makes the following computation after the elimination of null (arg1, arg2) pairs:REGR_COUNT(arg1, arg2) * VAR_POP(arg1)- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_syy(arg1, arg2)
-
regrSxy
public static WindowOver<Double> regrSxy(Expression<? extends Number> arg1, Expression<? extends Number> arg2) REGR_SXY makes the following computation after the elimination of null (arg1, arg2) pairs:REGR_COUNT(arg1, arg2) * COVAR_POP(arg1, arg2)
- Parameters:
arg1- first argarg2- second arg- Returns:
- regr_sxy(arg1, arg2)
-
cumeDist
CUME_DIST calculates the cumulative distribution of a value in a group of values.- Returns:
- cume_dist()
-
cumeDist
As an aggregate function, CUME_DIST calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the relative position of row r among the rows in the aggregation group. Oracle makes this calculation as if the hypothetical row r were inserted into the group of rows to be aggregated over. The arguments of the function identify a single hypothetical row within each aggregate group. Therefore, they must all evaluate to constant expressions within each aggregate group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore, the number of arguments must be the same and their types must be compatible.- Parameters:
args- arguments- Returns:
- cume_dist(args)
-
cumeDist
As an aggregate function, CUME_DIST calculates, for a hypothetical row r identified by the arguments of the function and a corresponding sort specification, the relative position of row r among the rows in the aggregation group. Oracle makes this calculation as if the hypothetical row r were inserted into the group of rows to be aggregated over. The arguments of the function identify a single hypothetical row within each aggregate group. Therefore, they must all evaluate to constant expressions within each aggregate group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore, the number of arguments must be the same and their types must be compatible.- Parameters:
args- arguments- Returns:
- cume_dist(args)
-
corr
public static WindowOver<Double> corr(Expression<? extends Number> expr1, Expression<? extends Number> expr2) CORR returns the coefficient of correlation of a set of number pairs.- Parameters:
expr1- first argexpr2- second arg- Returns:
- corr(expr1, expr2)
-
covarPop
public static WindowOver<Double> covarPop(Expression<? extends Number> expr1, Expression<? extends Number> expr2) CORR returns the coefficient of correlation of a set of number pairs.- Parameters:
expr1- first argexpr2- second arg- Returns:
- corr(expr1, expr2)
-
covarSamp
public static WindowOver<Double> covarSamp(Expression<? extends Number> expr1, Expression<? extends Number> expr2) CORR returns the coefficient of correlation of a set of number pairs.- Parameters:
expr1- first argexpr2- second arg- Returns:
- corr(expr1, expr2)
-
ratioToReport
computes the ratio of a value to the sum of a set of values. If expr evaluates to null, then the ratio-to-report value also evaluates to null.- Returns:
- ratio_to_report(expr)
-
rowNumber
number of the current row within its partition, counting from 1- Returns:
- row_number()
-
stddev
returns the sample standard deviation of expr, a set of numbers.- Parameters:
expr- argument- Returns:
- stddev(expr)
-
stddevDistinct
returns the sample standard deviation of expr, a set of numbers.- Parameters:
expr- argument- Returns:
- stddev(distinct expr)
-
stddevPop
returns the population standard deviation and returns the square root of the population variance.- Parameters:
expr- argument- Returns:
- stddev_pop(expr)
-
stddevSamp
returns the cumulative sample standard deviation and returns the square root of the sample variance.- Parameters:
expr- argument- Returns:
- stddev_samp(expr)
-
variance
returns the variance of expr- Parameters:
expr- argument- Returns:
- variance(expr)
-
varPop
returns the population variance of a set of numbers after discarding the nulls in this set.- Parameters:
expr- argument- Returns:
- var_pop(expr)
-
varSamp
returns the sample variance of a set of numbers after discarding the nulls in this set.- Parameters:
expr- argument- Returns:
- var_samp(expr)
-
firstValue
returns value evaluated at the row that is the first row of the window frame- Parameters:
expr- argument- Returns:
- first_value(expr)
-
lastValue
returns value evaluated at the row that is the last row of the window frame- Parameters:
expr- argument- Returns:
- last_value(expr)
-
left
Get the rhs leftmost characters of lhs- Parameters:
lhs- stringrhs- character amount- Returns:
- rhs leftmost characters
-
right
Get the rhs rightmost characters of lhs- Parameters:
lhs- stringrhs- character amount- Returns:
- rhs rightmost characters
-
left
Get the rhs leftmost characters of lhs- Parameters:
lhs- stringrhs- character amount- Returns:
- rhs leftmost characters
-
right
Get the rhs leftmost characters of lhs- Parameters:
lhs- stringrhs- character amount- Returns:
- rhs rightmost characters
-
groupConcat
Get a group_concat(expr) expression- Parameters:
expr- expression to be aggregated- Returns:
- group_concat(expr)
-
groupConcat
Get a group_concat(expr, separator) expression- Parameters:
expr- expression to be aggregatedseparator- separator string- Returns:
- group_concat(expr, separator)
-