【发布时间】:2016-06-23 07:53:09
【问题描述】:
我的电话号码字段中有垃圾,我想清理它们。我想知道如何查询以检查电话号码字段中是否有任何特殊字符、字母。有人可以帮忙吗? 我试过这个查询但没有用。我需要PostgreSQL中的代码
select phone from table where phone like '[^[:alpha:]]' and phone <>''
-- and phone not like '[^0-9]'
order by phone
表格中的输入值如下:
Phone
-----
(443)-554-6677
111-111-1111
345-rty-34fr
4345434444 ext
输出(应该看起来像这个有效的电话号码)
(443)-554-6677
111-111-1111
感谢您的帮助。
谢谢你, 斯瓦蒂。
【问题讨论】:
标签: sql postgresql