StmtSelectFields: SELECT fields statement.

StmtSelectFieldsR Documentation

SELECT fields statement.

Description

SELECT fields statement.

SELECT fields statement.

Details

This class represents a SQL SELECT statement with specific fields. It requires a list of ExprField instances representing the fields to select, with optional distinct keyword to remove duplicate results.

Super classes

sqlq::Statement -> sqlq::StmtSelect -> StmtSelectFields

Methods

Public methods

Inherited methods

Method new()

Initializer

Usage
StmtSelectFields$new(fields, distinct = FALSE)
Arguments
fields

A list of ExprField instances.

distinct

Set to TRUE enable distinct keyword and remove duplicate results.

Returns

Nothing.


Method getTokens()

Generates the list of tokens representing this statement.

Usage
StmtSelectFields$getTokens()
Returns

A list of Token objects.


Method clone()

The objects of this class are cloneable with this method.

Usage
StmtSelectFields$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# Create a SELECT statement with specific fields:
field1 <- ExprField$new("title", "books")
field2 <- ExprField$new("name", "authors")
select_fields <- StmtSelectFields$new(fields = list(field1, field2))

# Use the created SELECT statement inside a SELECT query:
query <- QuerySelect$new(select = select_fields,
                         from = StmtFrom$new("books"))


sqlq documentation built on Sept. 16, 2025, 9:10 a.m.