Some of the documentation contained herin uses some very simple SQL syntax to explain ideas. However, the audience of this documentation contains people who may or may not know SQL. The SQL used in this documentation, however, is an extremely small subset of the language, and can be explained in a few paragraphs here.
Types: Some of the documentation, and the data dictionary itself, describe data types using SQL's syntax. Here is a list of the types used:
integer
: A 32-bit signed integer.
float
: A floating point number.
date
: A calendar date.
char(N)
: A character string consisting of
exactly N characters, no more no less. Will be truncated
or padded with spaces to always be exactly N characters.
For most databases, N has an upper limit of 255.
varchar(M,N)
: A character string consisting
of no more than M characters, and no less than N characters.
(The ",N" part is optional, and if left off, is assumed to be
zero.) This kind of string can shrink and grow as needed
within the limits given in M and N. For most databases,
M and N have upper limits of 255.
text
: A free-form character string that can be
as long as desired, but takes some extra overhead in the
database to store and retrieve. Hence we only use it at BMRB
when the value is expected to be larger than can be stored
in a char
or varchar
.
SELECT queries: Occasionally, this documentation shows a "SELECT" query. The subset of the SELECT syntax that is used in this documentation is very simple and can be explained right here:
SELECT
list-of-fields
FROM
table-name
WHERE
conditional-statement
ORDER BY
list-of-fields ;
The explanation is pretty straightforward:
In reality, select statements can become much more complex than what is shown above, but this is enough to understand this documentation.