题解 | 电话号码格式校验
电话号码格式校验
https://www.nowcoder.com/practice/2c2453e909c04c29a04c11e9d6b2c769
select
*
from
contacts
where
(char_length(phone_number) = 10
or phone_number like '___-___-____')
and replace(phone_number,'-','') regexp '^[0-9]{10}$'
and left(phone_number, 1) <> '0'
order by
id;