Light
Dark
System

Primer

This page is indended as a rapid-fire overview of SDL syntax so you can hit the ground running with EdgeDB. Refer to the linked pages for more in-depth documentation.

Object types contain properties and links to other object types. They are analogous to tables in SQL.

Copy
type Movie {
  property title -> str;  # optional by default
}

See Schema > Object types.

Copy
type Movie {
  required property title -> str;       # required
  property release_year -> int64;       # optional
}

See Schema > Properties.

Copy
type Movie {
  required property title -> str {
    constraint unique;
    constraint min_len_value(8);
    constraint regexp(r'^[A-Za-z0-9 ]+$');
  }
}

See Schema > Constraints.

Copy
type Movie {
  required property title -> str;
  required property release_year -> int64;

  index on (.title);                        # simple index
  index on ((.title, .release_year));       # composite index
  index on (str_trim(str_lower(.title)));   # computed index
}

The id property, all links, and all properties with exclusive constraints are automatically indexed.

See Schema > Indexes.

Copy
type Movie {
  required property title -> str;
  property uppercase_title := str_upper(.title);
}

See Schema > Computeds.

Copy
abstract type Content {
  required property title -> str;
}

type Movie extending Content {
  required property release_year -> int64;
}

type TVShow extending Content {
  required property num_seasons -> int64;
}

See Schema > Object types > Inheritance.

Light
Dark
System