Previous Next

Boolean literals

SQL has a 3-valued system of evaluating boolean values (True, False, Unknown). 'Unknown' is represented by the NULL value and notated as:


The SQL language does not have a literal notation for the True value and the False value. In SQL queries, conditions are applied to evaluate data to True or False. Data that evaluate to True are returned in the query result and data that evaluate to False are stripped from it.

See also comparing with NULL. See also the IS NULL operator.

String literals

String literals are surrounded by single quotes:


Single quotes in values are escaped by adding an extra single quote:

'Anna''s car.'

Number literals

Number literals are notated as is:


IMPORTANT: A special concern with number literals is the use of . and , (comma) as group separator symbols. These symbols are interpreted variously as group separators or as decimal separators. This depends on a number of settings in your technology stack. This applies when inputting number literals and also when rendering returned number values. For details, see IO Formats.

Date and time literals

The SQL language does not have a literal notation for date and time values. You are reduced to notating dates and times are strings. You need to apply conversion functions to indicate which part of the string represents which part of the date and time. This applies when inputting date and time literals, and also when rendering returned date and time values. You can use the USoft-native DATE_TO_CHAR() and CHAR_TO_DATE() functions for this.

IMPORTANT: A stack of defaulting mechanisms is in operation here. Your OS may have ways to input and render dates and times. Your RDBMS also intervenes - for example, Oracle stores time values by default (using midnight as default time) even if you only use the date part, but SQL Server differentiates between storing dates without time and storing dates with time.

The USoft DEFAULT_DATE_FORMAT Rules Engine parameter determines the date IO format that the Rules Engine falls back on if no other date format information is available. For more details on date and time IO formats, see IO Formats.


See also

SQL expressions