Posted on November 21, 2019 by Dmitry Olshansky, Denis Redozubov (translation, editing) Matt Parsons talks about a few ways to encode sum types in relational databases in his blog. Not so long ago I was thinking about the same problem and came up with slightly different solutions. Let’s start with an example Matt had used: data Animal = Cat Name Age FavoriteFood | Dog Name OwnerId | Bird Name Song