SQL
Prev | The Symbolic SQL Syntax | Next

## Name

SQL — Construct an SQL string from supplied expressions.Function

## Syntax

          sql &rest args => sql-expression

## Arguments and Values

`args`

  A set of expressions.

sql-expression

  A string representing an SQL expression.

## Description

Returns an SQL string generated from the expressions `args`. The expressions are translated into SQL strings and then concatenated with a single space delimiting each expression.

## Examples

    (sql nil)
    => "NULL"

    (sql 'foo)
    => "FOO"

    (sql "bar")
     => "'bar'"

    (sql 10)
    => "10"

    (sql '(nil foo "bar" 10))
    => "(NULL,FOO,'bar',10)"

    (sql #(nil foo "bar" 10))
    => "NULL,FOO,'bar',10"

    (sql [select [foo] [bar] :from [baz]] 'having [= [foo id] [bar id]]
         'and [foo val] '< 5)
    => "SELECT FOO,BAR FROM BAZ HAVING (FOO.ID = BAR.ID) AND FOO.VAL < 5"

## Side Effects

None.

## Affected by

None.

## Exceptional Situations

An error of type `sql-user-error` is signalled if any element in `args` is not of the supported types (a symbol, string, number or symbolic SQL expression) or a list or vector containing only these supported types.

## See Also

`sql-expression`
`sql-operation`
`sql-operator`

## Notes

None.

Prev | Up | Next
FILE-ENABLE-SQL-READER-SYNTAX | Home | SQL-EXPRESSION