SQL with which to create the terms table