Greater Than methods
Definition
The Greater Than methods allow you to add the > operator to the query.
The methods available in Normal method name and the Short method name versions are:
Normal method name | Short method name | SQL to generate |
---|---|---|
greaterThan | gt | leftOp > rightOp |
iGreaterThan | igt | LOWER(leftOp) > LOWER(rightOp) |
notGreaterThan | ngt | NOT (leftOp > rightOp) |
notIGreaterThan | nigt | NOT (LOWER(leftOp) > LOWER(rightOp)) |
For all cases, the object that calls Greater Than methods will be placed as the operand on the left side of the > operator and the object or value received by parameter will be placed on the right side of the > operator.
1. greaterThan | gt
leftOperand > rightOperand
This method takes a single parameter and the possible values are:
KTableColumn
, KColumn
, Number
, String
, LocalDate
, LocalDateTime
, KValNumberField
, KValTextField
, KQuery
, KOptionalKColumn
, KOptionalNumber
, KOptionalString
, KOptionalLocalDate
, KOptionalLocalDateTime
, KOptionalKValNumberField
, KOptionalKValTextField
, KOptionalLong
.
If the object received by parameter is a KQuery
, it will be treated as a subquery and you must ensure that it returns only one column comparable to the operand on the left side of the condition.
Example: gt(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.gt(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name > au.last_name
Parameters:
- None
Example: gt(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.gt("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name > ?1
Parameters:
- ?1: "Jhon"
Example: gt(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.gt(optional(nullValue)))
.and(APP_USER.FIRST_NAME.gt(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name > ?1
Parameters:
- ?1: "Jhon"
Example: gt(KQuery)
Java code:
final KQuery subquery =
k
.select(max(APP_USER_SPECIALTY.APP_USER_ID))
.from(APP_USER_SPECIALTY);
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.ID.gt(subquery))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.id > (
SELECT MAX(aus.app_user_id)
FROM app_user_specialty aus
)
Parameters:
- None
2. iGreaterThan | igt
LOWER(leftOperand) > LOWER(rightOperand)
This method takes a single parameter and the possible values are:
KTableColumn
, KColumn
, String
, KValTextField
, KOptionalKColumn
, KOptionalString
, KOptionalKValTextField
.
Example: igt(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.igt(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE LOWER(au.first_name) > LOWER(au.last_name)
Parameters:
- None
Example: igt(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.igt("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE LOWER(au.first_name) > ?1
Parameters:
- ?1: "jhon"
Example: igt(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.igt(optional(nullValue)))
.and(APP_USER.FIRST_NAME.igt(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE LOWER(au.first_name) > ?1
Parameters:
- ?1: "jhon"
3. notGreaterThan | ngt
NOT (leftOperand > rightOperand)
This method takes a single parameter and the possible values are:
KTableColumn
, KColumn
, Number
, String
, LocalDate
, LocalDateTime
, KValNumberField
, KValTextField
, KQuery
, KOptionalKColumn
, KOptionalNumber
, KOptionalString
, KOptionalLocalDate
, KOptionalLocalDateTime
, KOptionalKValNumberField
, KOptionalKValTextField
, KOptionalLong
.
If the object received by parameter is a KQuery
, it will be treated as a subquery and you must ensure that it returns only one column comparable to the operand on the left side of the condition.
Example: ngt(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.ngt(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name > au.last_name)
Parameters:
- None
Example: ngt(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.ngt("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name > ?1)
Parameters:
- ?1: "Jhon"
Example: ngt(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.ngt(optional(nullValue)))
.and(APP_USER.FIRST_NAME.ngt(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name > ?1)
Parameters:
- ?1: "Jhon"
Example: ngt(KQuery)
Java code:
final KQuery subquery =
k
.select(max(APP_USER_SPECIALTY.APP_USER_ID))
.from(APP_USER_SPECIALTY);
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.ID.ngt(subquery))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (
au.id > (
SELECT MAX(aus.app_user_id)
FROM app_user_specialty aus
)
)
Parameters:
- None
4. notIGreaterThan | nigt
NOT (LOWER(leftOperand) > LOWER(rightOperand))
This method takes a single parameter and the possible values are:
KTableColumn
, KColumn
, String
, KValTextField
, KOptionalKColumn
, KOptionalString
, KOptionalKValTextField
.
Example: nigt(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nigt(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (LOWER(au.first_name) > LOWER(au.last_name))
Parameters:
- None
Example: nigt(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nigt("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (LOWER(au.first_name) > ?1)
Parameters:
- ?1: "jhon"
Example: nigt(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nigt(optional(nullValue)))
.and(APP_USER.FIRST_NAME.nigt(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (LOWER(au.first_name) > ?1)
Parameters:
- ?1: "jhon"