Implementation of the NYU ED algorithm in SQL