sql - 查找所有开头包含“+7”的数字
问题描述
我需要找到'+7'
开头包含的所有数字。
我想过,~
但它对我没有用。
SELECT *
from ds_phone
where number ~ '+7 \d'
解决方案
一种选择是使用substring()
函数:
select *
from ds_phone
where substring(number,1,2)='+7'
因为number
是字母数字列,所以不需要强制转换。
推荐阅读
- python - 使用 Python Selenium webdriver 时出现站点阻塞和验证码
- python - 访问下拉菜单中的选项时获取“StaleElementReferenceException”
- java - 如何在一行中显示数组列表中的所有项目
- c# - 解析器导致“文档没有页面”
- statistics - 你能从 Orange 的“特征统计”工具中创建一个表格输出吗?
- r - R sum vectors in list of list
- logging - Serilog 解构特定于接收器的策略
- visual-studio - Microsoft Quantum Development Kit 对称密钥加密
- java - 使用xml配置有条件地在spring boot中加载一个bean?
- jquery - 用户滚动时如何制作固定的导航栏和搜索栏?