From 3680a1beaeeb299632e717917d328ab227a098d5 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sat, 17 Jul 2021 18:59:26 -0700 Subject: [PATCH] Address #332 by improving select docs --- doc/clause-reference.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/clause-reference.md b/doc/clause-reference.md index 85581bf..1c3e7d8 100644 --- a/doc/clause-reference.md +++ b/doc/clause-reference.md @@ -302,6 +302,10 @@ user=> (sql/format '{select (id, ((* cost 2)), (event status)) ["SELECT id, cost * ?, event AS status FROM table" 2] ``` +Here, `:select` has a three expressions as its argument. The first is +a simple column name. The second is an expression with no alias, which +is why it is still double-nested. The third is a simple column name and its alias. + With an alias on the expression: ```clojure @@ -310,6 +314,10 @@ user=> (sql/format {:select [:id, [[:* :cost 2] :total], [:event :status]] ["SELECT id, cost * ? AS total, event AS status FROM table" 2] ``` +Here, `:select` has a three expressions as its argument. The first is +a simple column name. The second is an expression and its alias. The +third is a simple column name and its alias. + `:select-distinct` works the same way but produces `SELECT DISTINCT`. HoneySQL does not yet support `SELECT .. INTO ..` @@ -610,7 +618,6 @@ table expression and an alias. The table expression is `[:lateral ..]` and the alias expression is double-nested so that it is read as a function call: an invocation of `:raw`. - > Note: the actual formatting of a `:cross-join` clause is currently identical to the formatting of a `:select` clause. ## set (MySQL)