The paper defines entities, relationships, attributes, structural functions, and constraints concepts in the framework of the Elementary Mathematical Data Model (EMDM). An algorithm for computer-aided design of key type constraints, which starts with a possibly non-empty set of keys for any object set, and aimed at hopefully completing it with all other existing keys is then introduced and discussed. Finally, this algorithm is proved to be optimal.