diff options
-rw-r--r-- | README.md | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -37,10 +37,17 @@ Thus: `(and (= :name "Barry") (= (length :username) 10))` compiles into an SQL expression equivalent to `("name" = 'Barry' AND "length"("username") = 10)`. -A few more involved query examples: +A few more query examples: (require '[clojure-sql.core :as s]) + ;; this is only shown as a demonstration + ;; a query like this is not advised for general use + (s/table :users) + ;; => ["SELECT * FROM \"users\" AS \"users1715\""] + + ;; it is recommended that a query be projected first to provide + ;; clojure-sql with field information (-> (s/table :users) ;; tables are automatically given internal aliases (s/project [:id :username])) ;; => ["SELECT \"users3205\".\"id\" AS \"id\", \"users3205\".\"username\" AS \"username\" FROM \"users\" AS \"users3205\""] |