Module org.jooq
Package org.jooq

Interface Select<R extends Record>

Type Parameters:
R - The record type being returned by this query
All Superinterfaces:
Attachable, AttachableQueryPart, FieldLike, FieldOrRowOrSelect, Fields, Flow.Publisher<R>, Iterable<R>, Publisher<R>, org.reactivestreams.Publisher<R>, Query, QueryPart, ResultQuery<R>, Serializable, Statement, TableLike<R>
All Known Subinterfaces:
SelectConditionStep<R>, SelectConnectByAfterStartWithConditionStep<R>, SelectConnectByConditionStep<R>, SelectConnectByStep<R>, SelectCorrelatedSubqueryStep<R>, SelectDistinctOnStep<R>, SelectFinalStep<R>, SelectForJSONCommonDirectivesStep<R>, SelectForStep<R>, SelectForUpdateOfStep<R>, SelectForUpdateStep<R>, SelectForUpdateWaitStep<R>, SelectForXMLCommonDirectivesStep<R>, SelectForXMLPathDirectivesStep<R>, SelectForXMLRawDirectivesStep<R>, SelectFromStep<R>, SelectGroupByStep<R>, SelectHavingConditionStep<R>, SelectHavingStep<R>, SelectIntoStep<R>, SelectJoinStep<R>, SelectLimitAfterOffsetStep<R>, SelectLimitPercentAfterOffsetStep<R>, SelectLimitPercentStep<R>, SelectLimitStep<R>, SelectOffsetStep<R>, SelectOnConditionStep<R>, SelectOptionalOnStep<R>, SelectOptionStep<R>, SelectOrderByStep<R>, SelectQualifyConditionStep<R>, SelectQualifyStep<R>, SelectQuery<R>, SelectSeekLimitStep<R>, SelectSeekStep1<R,T1>, SelectSeekStep10<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, SelectSeekStep11<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>, SelectSeekStep12<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>, SelectSeekStep13<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>, SelectSeekStep14<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>, SelectSeekStep15<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>, SelectSeekStep16<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>, SelectSeekStep17<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17>, SelectSeekStep18<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18>, SelectSeekStep19<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19>, SelectSeekStep2<R,T1,T2>, SelectSeekStep20<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20>, SelectSeekStep21<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21>, SelectSeekStep22<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22>, SelectSeekStep3<R,T1,T2,T3>, SelectSeekStep4<R,T1,T2,T3,T4>, SelectSeekStep5<R,T1,T2,T3,T4,T5>, SelectSeekStep6<R,T1,T2,T3,T4,T5,T6>, SelectSeekStep7<R,T1,T2,T3,T4,T5,T6,T7>, SelectSeekStep8<R,T1,T2,T3,T4,T5,T6,T7,T8>, SelectSeekStep9<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>, SelectSeekStepN<R>, SelectSelectStep<R>, SelectStartWithStep<R>, SelectUnionStep<R>, SelectWhereStep<R>, SelectWindowStep<R>, SelectWithTiesAfterOffsetStep<R>, SelectWithTiesStep<R>

public non-sealed interface Select<R extends Record> extends ResultQuery<R>, TableLike<R>, FieldLike, FieldOrRowOrSelect
A SELECT statement.

Example:


 // Assuming import static org.jooq.impl.DSL.*;

 using(configuration)
    .select(ACTOR.FIRST_NAME, ACTOR.LAST_NAME)
    .from(ACTOR)
    .fetch();
 

Instances can be created using DSL.select(SelectFieldOrAsterisk...), or DSLContext.selectQuery() and overloads.

Author:
Lukas Eder
  • Method Details

    • union

      @NotNull @CheckReturnValue @Support @NotNull Select<R> union(Select<? extends R> select)
      Apply the UNION set operation.

      In SQL, a UNION is DISTINCT by default, meaning, duplicates are removed from the result set. So, this is the same as unionDistinct(Select). If duplicate removal isn't required, or already guaranteed by the data model, it is recommended to use unionAll(Select), instead.

      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • unionDistinct

      @NotNull @CheckReturnValue @Support @NotNull Select<R> unionDistinct(Select<? extends R> select)
      Apply the UNION DISTINCT set operation.

      In SQL, a UNION is DISTINCT by default. However, it is often useful to make this explicit to express intent when distinct removal is really desired.

      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • unionAll

      @NotNull @CheckReturnValue @Support @NotNull Select<R> unionAll(Select<? extends R> select)
      Apply the UNION ALL set operation.
      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • except

      Apply the EXCEPT (or MINUS) set operation.

      In SQL, an EXCEPT is DISTINCT by default, meaning, duplicates are removed from the result set. So, this is the same as exceptDistinct(Select). If duplicate removal isn't required, or already guaranteed by the data model, it is recommended to use exceptAll(Select), instead, if the underlying RDBMS supports it.

      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • exceptDistinct

      Apply the EXCEPT (or MINUS) set operation.

      In SQL, an EXCEPT is DISTINCT by default. However, it is often useful to make this explicit to express intent when distinct removal is really desired.

      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • exceptAll

      Apply the EXCEPT ALL set operation.
      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • intersect

      Apply the INTERSECT set operation.

      In SQL, an INTERSECT is DISTINCT by default, meaning, duplicates are removed from the result set. So, this is the same as intersectDistinct(Select). If duplicate removal isn't required, or already guaranteed by the data model, it is recommended to use intersectAll(Select), instead, if the underlying RDBMS supports it. Apply the INTERSECT set operation.

      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • intersectDistinct

      Apply the INTERSECT set operation.

      In SQL, a INTERSECT is DISTINCT by default. However, it is often useful to make this explicit to express intent when distinct removal is really desired.

      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • intersectAll

      Apply the INTERSECT ALL set operation.
      Throws:
      IllegalArgumentException - If the argument select has the same identity as this select. The jOOQ 3.x API is mutable, which means that calls to the DSL API mutate this instance. Adding this instance as an set operation argument would lead to a StackOverflowError when generating the SQL.
    • getSelect

      @NotNull @CheckReturnValue @NotNull List<Field<?>> getSelect()
      All fields selected in this query
    • $with

      @Experimental @Nullable @Nullable QOM.With $with()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $with

      @Experimental @CheckReturnValue @NotNull @NotNull Select<?> $with(QOM.With newWith)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $select

      @Experimental @NotNull @NotNull QOM.UnmodifiableList<? extends SelectFieldOrAsterisk> $select()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $select

      @Experimental @CheckReturnValue @NotNull @NotNull Select<?> $select(Collection<? extends SelectFieldOrAsterisk> newSelect)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $distinct

      @Experimental boolean $distinct()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $distinct

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $distinct(boolean newDistinct)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $distinctOn

      @Experimental @NotNull @NotNull QOM.UnmodifiableList<? extends SelectFieldOrAsterisk> $distinctOn()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $distinctOn

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $distinctOn(Collection<? extends SelectFieldOrAsterisk> newDistinctOn)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $from

      @Experimental @NotNull @NotNull QOM.UnmodifiableList<? extends Table<?>> $from()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $from

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $from(Collection<? extends Table<?>> newFrom)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $where

      @Experimental @Nullable @Nullable Condition $where()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $where

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $where(Condition newWhere)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $groupBy

      @Experimental @NotNull @NotNull QOM.UnmodifiableList<? extends GroupField> $groupBy()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $groupBy

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $groupBy(Collection<? extends GroupField> newGroupBy)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $groupByDistinct

      @Experimental boolean $groupByDistinct()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $groupByDistinct

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $groupByDistinct(boolean newGroupByDistinct)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $having

      @Experimental @Nullable @Nullable Condition $having()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $having

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $having(Condition newHaving)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $window

      @Experimental @NotNull @NotNull QOM.UnmodifiableList<? extends WindowDefinition> $window()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $window

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $window(Collection<? extends WindowDefinition> newWindow)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $qualify

      @Experimental @Nullable @Nullable Condition $qualify()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $qualify

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $qualify(Condition newQualify)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $orderBy

      @Experimental @NotNull @NotNull QOM.UnmodifiableList<? extends SortField<?>> $orderBy()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $orderBy

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $orderBy(Collection<? extends SortField<?>> newOrderBy)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $limit

      @Experimental @Nullable @Nullable Field<? extends Number> $limit()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $limit

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $limit(Field<? extends Number> newLimit)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $limitPercent

      @Experimental boolean $limitPercent()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $limitPercent

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $limitPercent(boolean newLimitPercent)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $limitWithTies

      @Experimental boolean $limitWithTies()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $limitWithTies

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $limitWithTies(boolean newLimitWithTies)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $offset

      @Experimental @Nullable @Nullable Field<? extends Number> $offset()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $offset

      @Experimental @CheckReturnValue @NotNull @NotNull Select<R> $offset(Field<? extends Number> newOffset)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $connectBy

      @Experimental @Pro @Nullable @Nullable Condition $connectBy()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $connectBy

      @Experimental @CheckReturnValue @Pro @NotNull @NotNull Select<R> $connectBy(Condition newConnectBy)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $connectByNoCycle

      @Experimental @Pro boolean $connectByNoCycle()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $connectByNoCycle

      @Experimental @CheckReturnValue @Pro @NotNull @NotNull Select<R> $connectByNoCycle(boolean newConnectByNoCycle)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $connectByStartWith

      @Experimental @Pro @Nullable @Nullable Condition $connectByStartWith()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $connectByStartWith

      @Experimental @CheckReturnValue @Pro @NotNull @NotNull Select<R> $connectByStartWith(Condition newConnectByStartWith)
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.