Everything about SQL database access is restricted to server-side code.
The fundamental unit of interest in the embedding of SQL is tables, described by a type family and creatable only via the declaration form.
The first argument to this constructor gives the names and types of a table's columns, and the second argument gives the set of valid keys. Keys are the only subsets of the columns that may be referenced as foreign keys. Each key has a name.
We also have the simpler type family of SQL views, which have no keys.
A multi-parameter type class is used to allow tables and views to be used interchangeably, with a way of extracting the set of columns from each.