Ask AI


This section describes the DDL commands pertaining to expression aliases.

Define a new expression alias in the schema.

[ with with-item [, ...] ]
create alias alias-name := alias-expr ;

[ with with-item [, ...] ]
create alias alias-name "{"
    using alias-expr;
    [ create annotation attr-name := attr-value; ... ]
"}" ;

where with-item is:

[ module-alias := ] module module-name

The command create alias defines a new expression alias in the schema. The schema-level expression aliases are functionally equivalent to expression aliases defined in a statement with block, but are available to all queries using the schema and can be introspected.

If name is qualified with a module name, then the alias is created in that module, otherwise it is created in the current module. The alias name must be distinct from that of any existing schema item in the module.

Most sub-commands and options of this command are identical to the SDL alias declaration, with some additional features listed below:

[ module-alias := ] module module-name

An optional list of module alias declarations to be used in the alias definition.

create annotation annotation-name := value;

An optional list of annotation values for the alias. See create annotation for details.

Create a new alias:

create alias Superusers := (
    select User filter = 'Superusers'

Remove an expression alias from the schema.

[ with with-item [, ...] ]
drop alias alias-name ;

The command drop alias removes an expression alias from the schema.


The name (optionally qualified with a module name) of an existing expression alias.

Remove an alias:

drop alias SuperUsers;