sql.select {RPgSQL}R Documentation

Format and optionally execute an SQL select query

Description

sql.select is a wrapper for the SQL SELECT command.

Usage

sql.select(columns="*", into, from, where, group.by, having, order.by, limit, distinct=F, exec=T)

Arguments

columns A list of column names
into Put results into a new table with this name
from Table name to select from
where A logical expression
group.by Group results by these columns
having I'm not sure what this does
order.by Sort results by these columns
limit Only return this many rows
offset Return rows beginning here (zero-based)
distinct If true, only distinct results are returned
exec If true, execute the query and return the results

Details

Table joins are impossible in sql.select. You must use db.execute and hand edit the query to do a join. select is meant to save a few key strokes and perhaps avoid a few typing errors.

Value

If exec is true, a data frame containing the results of the query. If exec is false, the formatted query string.

Author(s)

Timothy H. Keitt

See Also

db.execute

Examples

sql.select("usename", from="pg_user", where="usename = 'postgres'", exec=F)