Select Clause

In the select clause, you specify columns that will appear in the query results.

In the example, a select clause projects two columns, address and name, properties of the concept /customer. The alias for the customer concept is the letter c:

select c.name, c.address from /customer c

You can also give each projection an alias, for example:

select c.name as name

The use of the optional "as" makes the code more readable.

In the select clause you can use the following:

  • Literal values
  • Catalog functions and rule functions
  • Entities that are declared in the from clause, unless you are using a group by clause (see Group by Clause)

You can use an optional limit clause to specify the maximum number of rows to return, and you can use an offset to ignore the first n rows.

You can use an optional distinct clause to prevent the query from returning duplicate rows.

Examples of Select Clauses

These examples show only the select clause. A complete query requires a select and a from clause. (# is the escape character. See Keywords and Other Reserved Words.)

select A.*
select {limit: first 10} A.name
select /#DateTime/now() as C
select /RuleFunctions/GetState() as D
select /#String/concat(B.customerId,”ABC”) as E
select B.*, A.custId id, B@extId as extId