SML# Document Version 3.7.1
22 SQL Expressions and Commands

22.11 Difference from the standard SQL (Informative)

SML#’s SQL syntax is designed to be similar to the standard SQL as much as possible so that the programmer can use it without learning a new embedded language. However, it is inebitable that some SQL notations cannot be used due to the conflict with the host language syntax. This section summarizes the difference between SML# and SQL. By paying attention to the following, you can exploit the SML#’s SQL feature with the standard notation of SQL.

  • Constant literals are written in the SML# notation.

  • All the keywords must be in small cases in SML#, whereas the keywords of the standard SQL are case-insensitive,

  • The names of tables and columns are case-sensitive in SML#. Only one exception is that names are compared with ignoring the cases when SQL.connect checks schema.

  • The arguments of function applications does not need to be parenthesized as in SML#, whereas the standard SQL requires the arguments parenthesized.

  • The unary minus operator is ~, not -.

  • The associativity of infix operators are decided by SML#’s infix declarations.

  • The logical conjunction operator and may occur only in a parenthesized expression.

  • Each column reference must be prefixed with #.

  • A table name is required in each column reference.

  • When an ORDER BY clause refers to a column of the SELECT clause, the reference must be prefixed with #..

  • Each table name occuring in a FROM clause or an INSERT, UPDATE, or DELETE command must be prefixed with # and an identifier indicating an database instance, which is typically bound by an _sql or fn expression.