If you want to create an SQL constraint into the existing table be sure that the existing data does not violate the constraint otherwise it will not be created. In such case, you should customize the data to match the constraint and after that to create it.