Using the REPL​

Execute a query. To execute a query in the REPL, terminate the statement with a semicolon and press “ENTER”.

  1. select 5;
  1. {5}

Alternatively, you can run the query without a semicolon with ⌥-Enter on macOS or Alt-Enter on Windows/Linux.

  1. select 5
  1. {5}

Use query parameters. If your query contains a parameter, you will be prompted for a value.

  1. select 5 + <int64>$num;
  1. Parameter <int64>$num: 6
  2. {11}

List databases:

  1. \l
  1. List of databases:
  2. db
  3. tutorial

Connect to a database:

  1. \c my_new_project
  1. my_new_project>

List modules:

  1. \lm

List object types:

  1. \lt

List scalar types:

  1. \ls

List expression aliases (the -v includes the expression value in the listing):

  1. \la -v

Describe an object type:

  1. \d object Object
  1. abstract type std::Object extending std::BaseObject {
  2. required single link __type__ -> schema::Type {
  3. readonly := true;
  4. };
  5. required single property id -> std::uuid {
  6. readonly := true;
  7. };
  8. };

Describe a scalar type:

  1. \d object decimal
  1. scalar type std::decimal extending std::anynumeric;

Describe a function:

  1. \d object sum
  1. function std::sum(s: set of std::bigint) -> std::bigint {
  2. volatility := 'Immutable';
  3. annotation std::description := 'Return the sum of the set of numbers.';
  4. using sql function 'sum'
  5. ;};
  6. function std::sum(s: set of std::int32) -> std::int64 {
  7. volatility := 'Immutable';
  8. annotation std::description := 'Return the sum of the set of numbers.';
  9. using sql function 'sum'
  10. ;};
  11. function std::sum(s: set of std::decimal) -> std::decimal {
  12. volatility := 'Immutable';
  13. annotation std::description := 'Return the sum of the set of numbers.';
  14. using sql function 'sum'
  15. ;};
  16. function std::sum(s: set of std::float32) -> std::float32 {
  17. volatility := 'Immutable';
  18. annotation std::description := 'Return the sum of the set of numbers.';
  19. using sql function 'sum'
  20. ;};
  21. function std::sum(s: set of std::int64) -> std::int64 {
  22. volatility := 'Immutable';
  23. annotation std::description := 'Return the sum of the set of numbers.';
  24. using sql function 'sum'
  25. ;};
  26. function std::sum(s: set of std::float64) -> std::float64 {
  27. volatility := 'Immutable';
  28. annotation std::description := 'Return the sum of the set of numbers.';
  29. using sql function 'sum'
  30. ;};