LanguageNames and comments

Names and comments

Names follow the rules of most programming languages, with backticks for everything else.

Names

A name is ASCII letters, digits and _, and does not start with a digit: order_items, created_at. Anything else goes in backticks:

lines.erdOpen in playground
table `order-items` "Lines of an order" {
  id            bigint         pk
  `unit price`  decimal(12,2)
}
The diagram resin draws for lines.erdThe diagram resin draws for lines.erd

A backtick name can hold any character except a backtick or a newline: hyphens, spaces, Hangul. `users` and users are the same name. A name made of non-ASCII letters must be in backticks, as in `주문`; resin says so and suggests the fix.

Keywords are not reserved

table, external, pk, uk, enc, enum, index, unique, as and audit are keywords only where they make sense, so a column may be called index. A backtick name is never a keyword.

Strings

Descriptions are in double quotes and end on the same line. Two escapes are recognized: \" and \\.

Comments

%% starts a comment that runs to the end of the line.

%% Orders, from the order service
table orders {
  id  bigint  pk  %% generated by the database
}