SML# Document Version 4.0.0
III Reference manual

Chapter 22 SQL Expressions and Commands

SML# includes database queries compliant to the standard SQL as SML# expressions. The SQL queries and their fragments are first-class citizens; therefore, SQL queries as well as SML# expressions have SML# types and are typechecked under the type system of SML#. In addition, SQL queries can be freely combined with any other SML# constructs as long as their types are consistent. For example, you can construct SQL query fragments as data structures, keep them in variables or function arguments, and make a complete SQL query by combining them at runtime.