A Cup of ChaiSQL: Benefits of Type Checking for SQL
Structured Query Language (SQL) remains the main language for database interaction in industry and education. However, SQL is known to be complex to master and associated with persistent errors. For many general-purpose programming languages, introducing optional type systems lowered the error rate, improved understanding, and increased developer performance on complex tasks. To achieve comparable benefits, we propose to extend SQL with optional type annotations and an explicit static type system. In this paper, we present the early design and evaluation of ChaiSQL - an optional, comment-based, static type-checker and CLI tool for type safety analyses. Our type system builds upon existing work in formalizing SQL semantics and designing type systems for query languages allowing for future extensions. To assess our design, we created a Wizard of Oz prototype along with a minimal formal type system. Using this prototype, we evaluated the ChaiSQL interface by conducting an exploratory think-aloud user study focused on the system’s usability and applicability. Our participants were positive about ChaiSQL: they felt it could lead to lower error rates and better understanding, and suggested a number of possible use cases and design improvements.