Function
sql
select &rest selections &key all flatp set-operation distinct from where group-by having order-by database => result-list
A set of database identifiers or strings.
A boolean.
A boolean.
An SQL operation.
A boolean.
An SQL table.
An SQL condition.
An SQL condition.
An SQL condition.
An SQL condition.
A database.
A list of selections.
select selects data from database, which has a default value of*default-database*, given the constraints specified by the rest of the arguments. It returns a list of objects as specified by selections. By default, the objects will each be represented as lists of attribute values. The argument selections consists either of database-identifiers or literal strings. nil, specifies if full bracketed results should be returned for each matched entry. If flatp isnil, the results are returned as a list of lists. If flatp ist, the results are returned as elements of a list, only if there is only one result per row. See the examples section for an example of the use of flatp. select function is common across both the functional and object-oriented SQL interfaces. If selections refers to view classes then the select operation becomes object-oriented.This means thatselect returns a list of view-class instances, andslot-valuebecomes a valid SQL operator for use within the where clause. select function are specified using the square bracket syntax, once this syntax has been enabled using enable-sql-reader-syntax. (select [person_id] [surname] :from [person]) => ((111 "Brown") (112 "Jones") (113 "Smith"))
t, and the result is a simple list of surname values:
(select [surname] :from [person] :flatp t)
=> ("Brown" "Jones" "Smith")
print-query