trait Select[Q, R] extends Renderable with Aggregatable[Q] with Joinable[Q, R] with JoinOps[Select, Q, R] with Query[Seq[R]] with DelegateQueryable[Q, Seq[R]] with Wrapped

A SQL SELECT query, possible with JOIN, WHERE, GROUP BY, ORDER BY, LIMIT, OFFSET clauses

Models the various components of a SQL SELECT:

SELECT DISTINCT column, AGG_FUNC(column_or_expression), …
FROM mytable
JOIN another_table ON mytable.column = another_table.column
WHERE constraint_expression
GROUP BY column HAVING constraint_expression
ORDER BY column ASC/DESC
LIMIT count OFFSET COUNT;

Good syntax reference:

https://www.cockroachlabs.com/docs/stable/selection-queries#set-operations https://www.postgresql.org/docs/current/sql-select.html

Linear Supertypes
Wrapped, DelegateQueryable[Q, Seq[R]], Query[Seq[R]], JoinOps[Select, Q, R], Joinable[Q, R], Aggregatable[Q], WithSqlExpr[Q], Renderable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Select
  2. Wrapped
  3. DelegateQueryable
  4. Query
  5. JoinOps
  6. Joinable
  7. Aggregatable
  8. WithSqlExpr
  9. Renderable
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def aggregate[E, V](f: (Proxy[Q]) => E)(implicit qr: Row[E, V]): Aggregate[E, V]

    Performs one or more aggregates in a single Select

  2. abstract def aggregateExpr[V](f: (Q) => (Context) => SqlStr)(implicit arg0: TypeMapper[V], qr: Row[Expr[V], V]): Expr[V]
    Definition Classes
    Aggregatable
  3. abstract def asc: Select[Q, R]

    Combined with sortBy to make the sort order ascending, translates into SQL ASC

  4. abstract def compound0(op: String, other: Select[Q, R]): CompoundSelect[Q, R]
    Attributes
    protected
  5. abstract def desc: Select[Q, R]

    Combined with sortBy to make the sort order descending, translates into SQL DESC

  6. abstract def dialect: DialectTypeMappers
    Attributes
    protected
  7. abstract def drop(n: Int): Select[Q, R]

    Drops the first n rows from this Select.

    Drops the first n rows from this Select. Like when used in Scala collections, if called multiple times the dropped rows add up

  8. abstract def expr: Q
    Attributes
    protected
    Definition Classes
    WithSqlExpr
  9. abstract def filter(f: (Q) => Expr[Boolean]): Select[Q, R]

    Filters this Select with the given predicate, translates into a SQL WHERE clause

  10. abstract def filterIf(cond: Boolean)(f: (Q) => Expr[Boolean]): Select[Q, R]

    Filters this Select with the given predicate, if cond evaluates to true

  11. abstract def filterOpt[T](option: Option[T])(f: (Q, T) => Expr[Boolean]): Select[Q, R]

    Filters this Select with the given predicate consuming provided option as a part of predicate's input, if this option is Some[T]

  12. abstract def flatMap[Q2, R2](f: (Q) => Rhs[Q2, R2])(implicit qr: Row[Q2, R2]): Select[Q2, R2]

    Performs an implicit JOIN between this Select and the one returned by the callback function f

  13. abstract def groupBy[K, V, R2, R3](groupKey: (Q) => K)(groupAggregate: (Proxy[Q]) => V)(implicit qrk: Row[K, R2], qrv: Row[V, R3]): Select[(K, V), (R2, R3)]

    Translates into a SQL GROUP BY, takes a function specifying the group-key and a function specifying the group-aggregate.

  14. abstract def join0[Q2, R2, QF, RF](prefix: String, other: Joinable[Q2, R2], on: Option[(Q, Q2) => Expr[Boolean]])(implicit ja: JoinAppend[Q, Q2, QF, RF]): Select[QF, RF]
    Attributes
    protected
    Definition Classes
    JoinOps
  15. abstract def leftJoin[Q2, R2](other: Joinable[Q2, R2])(on: (Q, Q2) => Expr[Boolean])(implicit joinQr: Row[Q2, R2]): Select[(Q, JoinNullable[Q2]), (R, Option[R2])]

    Performs a LEFT JOIN on the given other, typically a Table or Select.

  16. abstract def map[Q2, R2](f: (Q) => Q2)(implicit qr: Row[Q2, R2]): Select[Q2, R2]

    Transforms the return value of this Select with the given function

  17. abstract def mapAggregate[Q2, R2](f: (Q, Proxy[Q]) => Q2)(implicit qr: Row[Q2, R2]): Select[Q2, R2]

    Performs a .map which additionally provides a Aggregatable.Proxy that allows you to perform aggregate functions.

  18. abstract def nullsFirst: Select[Q, R]

    Combined with sortBy to configure handling of nulls, translates into SQL NULLS FIRST

  19. abstract def nullsLast: Select[Q, R]

    Combined with sortBy to configure handling of nulls, translates into SQL NULLS LAST

  20. abstract def outerJoin[Q2, R2](other: Joinable[Q2, R2])(on: (Q, Q2) => Expr[Boolean])(implicit joinQr: Row[Q2, R2]): Select[(JoinNullable[Q], JoinNullable[Q2]), (Option[R], Option[R2])]

    Performs a OUTER JOIN on the given other, typically a Table or Select.

  21. abstract def qr: Row[Q, R]
    Definition Classes
    SelectDelegateQueryable
  22. abstract def queryConstruct(args: ResultSetIterator): Seq[R]
    Attributes
    protected
    Definition Classes
    Query
  23. abstract def rightJoin[Q2, R2](other: Joinable[Q2, R2])(on: (Q, Q2) => Expr[Boolean])(implicit joinQr: Row[Q2, R2]): Select[(JoinNullable[Q], Q2), (Option[R], R2)]

    Performs a RIGHT JOIN on the given other, typically a Table or Select.

  24. abstract def selectExprAliases(prevContext: Context): Seq[(Identity, SqlStr)]
    Attributes
    protected
    Definition Classes
    Wrapped
  25. abstract def selectRenderer(prevContext: Context): Renderer
    Attributes
    protected
    Definition Classes
    Wrapped
  26. abstract def selectToSimpleSelect(): SimpleSelect[Q, R]
    Attributes
    protected
  27. abstract def selectWithExprPrefix(preserveAll: Boolean, s: (Context) => SqlStr): Select[Q, R]
    Attributes
    protected
  28. abstract def selectWithExprSuffix(preserveAll: Boolean, s: (Context) => SqlStr): Select[Q, R]
    Attributes
    protected
  29. abstract def sortBy(f: (Q) => Expr[_]): Select[Q, R]

    Sorts this Select via the given expression.

    Sorts this Select via the given expression. Translates into a SQL ORDER BY clause. Can be called more than once to sort on multiple columns, with the last call to sortBy taking priority. Can be followed by asc, desc, nullsFirst or nullsLast to configure the sort order

  30. abstract def take(n: Int): Select[Q, R]

    Only returns the first n rows from this Select.

    Only returns the first n rows from this Select. Like when used in Scala collections, if called multiple times only the smallest value of n takes effect

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  6. def contains(other: Q): Expr[Boolean]

    Returns whether or not the Select on the left contains the other value on the right

  7. def crossJoin[Q2, R2, QF, RF](other: Joinable[Q2, R2])(implicit ja: JoinAppend[Q, Q2, QF, RF]): Select[QF, RF]

    Performs a CROSS JOIN, which is an INNER JOIN but without the ON clause

    Performs a CROSS JOIN, which is an INNER JOIN but without the ON clause

    Definition Classes
    JoinOps
  8. def crossJoin[Q2, R2](): Mapper[Q, Q2, R, R2]

    Version of crossJoin meant for usage in for-comprehensions

    Version of crossJoin meant for usage in for-comprehensions

    Definition Classes
    Joinable
  9. def distinct: Select[Q, R]

    Causes this Select to ignore duplicate rows, translates into SQL SELECT DISTINCT

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def except(other: Select[Q, R]): Select[Q, R]

    Subtracts the other from this Select, returning only rows present this but absent in other, and removing duplicates.

    Subtracts the other from this Select, returning only rows present this but absent in other, and removing duplicates. Translates into SQL EXCEPT

  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  15. def head: Single[R]

    Shorthand for .take(1).single:

    Shorthand for .take(1).single:

    1. If the query returns a single row, this returns it as a single value of type R 2. If the query returns multiple rows, returns the first as a single value of type R and discards the rest 3. If the query returns zero rows, throws an exception.

  16. def intersect(other: Select[Q, R]): Select[Q, R]

    Intersects the result rows of this Select with another, preserving only rows present in both this and the other and removing duplicates.

    Intersects the result rows of this Select with another, preserving only rows present in both this and the other and removing duplicates. Translates into SQL INTERSECT

  17. def isEmpty: Expr[Boolean]

    Returns whether or not the Select on the left is empty with zero elements

  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def join[Q2, R2, QF, RF](other: Joinable[Q2, R2])(on: (Q, Q2) => Expr[Boolean])(implicit ja: JoinAppend[Q, Q2, QF, RF]): Select[QF, RF]

    Performs a JOIN/INNER JOIN on the given other, typically a Table or Select.

    Performs a JOIN/INNER JOIN on the given other, typically a Table or Select.

    Definition Classes
    JoinOps
  20. def join[Q2, R2](on: (Q) => Expr[Boolean]): Mapper[Q, Q2, R, R2]

    Version of join meant for usage in for-comprehensions

    Version of join meant for usage in for-comprehensions

    Definition Classes
    Joinable
  21. def joinInfo[Q2, R2](joinPrefix: String, other: Joinable[Q2, R2], on: Option[(Q, Q2) => Expr[Boolean]]): (Seq[Join], Q2)
    Attributes
    protected
    Definition Classes
    JoinOps
  22. def joinableToFromExpr: (From, Q)
    Attributes
    protected
    Definition Classes
    SelectJoinable
  23. def leftJoin[Q2, R2](on: (Q) => Expr[Boolean]): NullableMapper[Q, Q2, R, R2]

    Version of leftJoin meant for usage in for-comprehensions

    Version of leftJoin meant for usage in for-comprehensions

    Definition Classes
    Joinable
  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. def newCompoundSelect[Q, R](lhs: SimpleSelect[Q, R], compoundOps: Seq[Op[Q, R]], orderBy: Seq[OrderBy], limit: Option[Int], offset: Option[Int])(implicit qr: Row[Q, R], dialect: DialectTypeMappers): CompoundSelect[Q, R]
    Attributes
    protected
  26. def newSimpleSelect[Q, R](expr: Q, exprPrefix: Option[(Context) => SqlStr], exprSuffix: Option[(Context) => SqlStr], preserveAll: Boolean, from: Seq[From], joins: Seq[Join], where: Seq[Expr[_]], groupBy0: Option[GroupBy])(implicit qr: Row[Q, R], dialect: DialectTypeMappers): SimpleSelect[Q, R]
    Attributes
    protected
  27. def nonEmpty: Expr[Boolean]

    Returns whether or not the Select on the left is nonempty with one or more elements

  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  30. def queryGetGeneratedKeys: Option[Row[_, _]]
    Attributes
    protected
    Definition Classes
    Query
  31. def queryIsExecuteUpdate: Boolean
    Attributes
    protected
    Definition Classes
    DelegateQueryableQuery
  32. def queryIsSingleRow: Boolean
    Attributes
    protected
    Definition Classes
    SelectDelegateQueryableQuery
  33. def queryWalkExprs(): Seq[Expr[_]]
    Attributes
    protected
    Definition Classes
    DelegateQueryableQuery
  34. def queryWalkLabels(): Seq[List[String]]
    Attributes
    protected
    Definition Classes
    DelegateQueryableQuery
  35. def single: Single[R]

    Asserts that this query returns exactly one row, and returns a single value of type R rather than a Seq[R].

    Asserts that this query returns exactly one row, and returns a single value of type R rather than a Seq[R]. Throws an exception if zero or multiple rows are returned.

  36. def subquery: SimpleSelect[Q, R]

    Forces this Select to be treated as a subquery that any further operations will operate on, rather than having some operations flattened out into clauses in this Select

  37. def subqueryRef(implicit qr: Row[Q, R]): SubqueryRef
    Attributes
    protected
  38. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  39. def toExpr(implicit mt: TypeMapper[R]): Expr[R]

    Converts this Select into an Expr, assuming it returns a single row and a single column.

    Converts this Select into an Expr, assuming it returns a single row and a single column. Note that if this returns multiple rows, behavior is database-specific, with some like Sqlite simply taking the first row while others like Postgres/MySql throwing exceptions

  40. def toString(): String
    Definition Classes
    AnyRef → Any
  41. def union(other: Select[Q, R]): Select[Q, R]

    Concatenates the result rows of this Select with another and removes duplicate rows; translates into SQL UNION

  42. def unionAll(other: Select[Q, R]): Select[Q, R]

    Concatenates the result rows of this Select with another; translates into SQL UNION ALL

  43. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  44. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  45. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  46. def withFilter(f: (Q) => Expr[Boolean]): Select[Q, R]

    Alias for filter

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from Wrapped

Inherited from DelegateQueryable[Q, Seq[R]]

Inherited from Query[Seq[R]]

Inherited from JoinOps[Select, Q, R]

Inherited from Joinable[Q, R]

Inherited from Aggregatable[Q]

Inherited from WithSqlExpr[Q]

Inherited from Renderable

Inherited from AnyRef

Inherited from Any

Ungrouped