一:数据库中一字段存入的是电话号码,要求查询出137至139号段的所有号码.
1:select * from telphone where code >= 13700000000 and code <= 13999999999;
2:select * from telphone where code BETWEEN 13700000000 and 13999999999;
二:要求查询出电话号码中以1开头第四位是5的电话号码
select * from telphone where left(code,1) = 1 and right(left(code,4),1) = 5;
left函数是从code字段左边第一位开始截取,第二个参数是截取几个字符
right函数是从code字段右边第一位开始截取,第二个参数是截取几个字符