In short: I prefer strict tables in SQLite because they avoid some datatype problems, such as putting text in number columns.SQLite has a feature that I think is underrated: strict tables. Strict tables help enforce rigid typing, preventing mistakes like putting text into integer columns. I like them, and wrote this post to promote their use!To make a strict table, add STRICT to the end of its definition. Like this:-CREATE TABLE people (name TEXT); +CREATE TABLE people (name TEXT) STRICT; That’s it! But what does it do?Advantages of strict tablesBroadly, strict tables help enforce rigid types, like other SQL engines do.Prevents type mismatches on insert/updateMost significantly, strict tables keep you from inserting the wrong type into a column. For example, SQLite normally lets you put…
Prefer Strict Tables in SQLite
Advertisement