MySQL Queriable Field Constraint by RegEx

假装没事ソ 提交于 2019-12-13 07:18:40

问题


In addition to a data type of VARCHAR(255), I'd like to add a constraint to the data by a regular expression, e.g. [a-zA-Z ].

I'd like to be able to query the regex, like how I can query meta data in the information_schema.

I've seen some related posts, but not exactly what I'm looking for. I've seen: Restrict varchar() column to specific values? which shows how to use constaints, and I've seen via triggers here: Is it Possible to Enforce Data Checking in MySQL using Regular expression

Can RegExs be used as constraints and those constraints be queried? If so, how?

来源:https://stackoverflow.com/questions/35142303/mysql-queriable-field-constraint-by-regex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!