Skip to main content


The :command specifies the underlying database command to run for the given SQL. The built-in values are:

  • :query or :? Query with a result-set (default)
  • :execute or :! Any statement
  • :returning-execute or :<! Support for INSERT ... RETURNING
  • :insert or :i! Support for insert and jdbc .getGeneratedKeys

:query and :execute mirror the distinction between query and execute! in the library and fetch and execute in the clojure.jdbc library.

For more information about :returning-execute and :insert, see Insert.

:query is the default command when no command is specified.


To save some typing, the command can be specified as the second value for the :name key:

-- :name all-characters :?

You can create command functions of your own by implementing a hugsql.core/hugsql-command-fn multimethod.