1. 如何用sql语句查询一个表名中重名的人
1、创建测试表,
create table test_name(id int , name varchar2(20));
2. 如何用SQL语句实现查询名字
假设表叫【tab_1】
该表的“姓名”字段是【name】
假设你要查的这个人的姓是【张】
select
*
from
tab_1
where
name
like
'张%';
“%”是通配符,类似于windows文件搜索中的通配符“*”
上面SQL的意思是,搜索tab_1表中,所有姓张的人员信息
返回值可能是:
name`````…………
-------------------------
张三`````…………
张小薇```…………
张伯伦```…………
张可`````…………
假设知道这个人的名(例如:什么小田),不知道姓,就这样查:
select
*
from
tab_1
where
name
like
'%小田';
3. 如何用sql语句模糊查询姓名中有三个词的人名,比如“king george V”,where name like'...'
假设有表T,A为人名字段,人名中的空格可能不止一个,可能有多个,直接用空格数,或是长度数来计算,可能潜在一些问题,所以应该先作简单处理一下,把所有不同长度(这里假设最长为10)的空格,转成一个空格,再计算长度.
select * from
(
select 'A'=
case
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
when charindex(' ',A,1)>0 then replace(A,' ',' ')
end
from T
) M
where len(A)-len(replace(A,' ',''))>=2
希望以上对你有所帮助!
4. 用SQL查询同姓人名语句的
假设姓名字段为name:
slect * from 表名 where name like'姓%'
将语句中’姓‘,替换成你想要的姓,如:李、司马等,复姓也可以
5. sql 如何模糊查询外国人名
问题再补充详细一点吧。。
6. 如何用SQL语句实现查询名字
可以用SQL的模糊查询。语句如下
select * from 表名 where 字段 like '%关键字%'
其中 % 为通配符。
条件的意思就是查找字段里面带“关键字”的数据。
7. SQL2008R2 需要使用什么字符集,才能兼容外国人名中间的点
这是因为你的数据库设置的字符集不支持该字符。建议设置为UNICODE或者UTF-8字符集试一试。
8. SQL中怎么 查询所有订购了货物的客户的姓名,电话,以及订购的货物的名称
首先您要确认涉及订购了货物的相关表名称,然后选取所需要查看的表字段,脚本语法是
select name,--姓名
phone,--电话
huowu--货物
from table1 --查询表名;
望采纳谢谢。
9. sql 查处人名了怎么查询详细信息
select 人名.人名,详细信息.*
from 人名,详细信息
where 人名.id = 详细信息.id
10. 如何用sql语句模糊查询姓名中有三个词的人名,比如“king george V”,where name like'...'
oracle 正则表达式
SQL> select sysdate
2 from al
3 where regexp_like('king george V',
4 '^[a-zA-z]+[ ]+[a-zA-z]+[ ]+[a-zA-z]+$')
5 ;
SYSDATE
-----------
2009-5-20 上
----------------------------------------------
SQL> select sysdate
2 from al
3 where regexp_like('king george V',
4 '^[a-zA-z]+[ ]+[a-zA-z]+[ ]+[a-zA-z]+$');
SYSDATE
-----------
2009-5-20 上
------------------------------