我怎样才能写检查约束

How can i write check constraint

我如何为一列写检查约束说 class_id 其中检查条件应该是:字符串以 CLS 开头,后跟任何 5 位数字。 例如:CL100987CLS45678

try using regex

类似的东西

WHERE REGEXP_LIKE (COLUMN_CONDITION,'^CLS.*([0-9]{5})');

| REGEXP_LIKE -> like specific to regex | column_condition -> explicit | '^**." -> start with and followed by any char | ([0-9]) - > only numerics | {5} -> the number of numerics in the expression

pay attention to your dbms, some differences 

hope this could help