We present a simple database definition language of categories and functors. A database schema is a small category, and an instance is a set-valued functor on it. We show how morphisms of schemas induce three data migration functors which parameterize projections, unions and joins over all tables simultaneously. These can be used in place of conjunctive or disjunctive queries. We also show how to connect a database to Functional Programming by introducing a functorial connection between the schema and the category of types for that language.

Share This