split_query {queryparser}R Documentation

Split a SQL query

Description

Splits a SQL SELECT statement into clauses, and splits comma-separated column lists within the clauses.

Usage

split_query(query, tidyverse)

Arguments

query

a character string containing a SQL SELECT statement

tidyverse

for queryparser internal use only

Value

A list object with named elements representing the clauses of the query

See Also

parse_query

Examples

my_query <- "SELECT origin, dest,
    COUNT(flight) AS num_flts,
    round(AVG(distance)) AS dist,
    round(AVG(arr_delay)) AS avg_delay
  FROM flights
  WHERE distance BETWEEN 200 AND 300
    AND air_time IS NOT NULL
  GROUP BY origin, dest
  HAVING num_flts > 3000
  ORDER BY num_flts DESC, avg_delay DESC
  LIMIT 100;"

split_query(my_query)

[Package queryparser version 0.3.2 Index]