当前位置:首页 » 编程语言 » sql查询排除

sql查询排除

发布时间: 2024-09-14 10:44:58

1. sql 查询排除一个字段的其他字段

1、创建测试表,此处以创建6个字段为例,实际100个字段的话,操作类似,

create table test_sel_cols(id number, password varchar2(200), remark1 varchar2(100), remark2 varchar2(100), remark3 varchar2(100), remark4 varchar2(100));

2. SQL的查询语句(除法)有哪些

如下:

select * from table1 where 工资>2500 and 工资<3000 //同上

select 姓名 from table1 where 性别='0' and 工资='4000'

select * from table1 where not 工资= 3200

select * from table1 order by 工资desc //将工资按照降序排列

select * from table1 order by 工资 asc //将工资按照升序排列

select * from table1 where year(出身日期)=1987 //查询table1 中所有出身在1987的人select * from table1 where name like '%张' /'%张%' /'张%' //查询1,首位字‘张’3,尾位字‘张’2,模糊查询

select * from table1 order by money desc //查询表1按照工资的降序排列表1 (升序为asc)

select * from table1 where brithday is null //查询表1 中出身日期为空的人

3. sql查询除了某个字段的值以外的其实记录

方法和详细的操作步骤如下:

1、第一步,需要创建一个临时的表,见下图,转到下面的步骤。

4. sql排除查询

select * from test1 a left join test2 b
on a.cname=b.cname
where b.pname is null and b.b.cname is not null

最简单的还是直接用left join....有效率点..如果用in,效率慢多了.

热点内容
90岁老年人助听器如何配置 发布:2025-07-02 00:59:16 浏览:815
配置ip代理服务器加速软件 发布:2025-07-02 00:58:32 浏览:693
linux链接库 发布:2025-07-02 00:53:06 浏览:676
数据库的划分的 发布:2025-07-02 00:43:19 浏览:655
补码源码和 发布:2025-07-02 00:37:25 浏览:979
centos7mysql远程访问 发布:2025-07-02 00:35:58 浏览:712
有线认证服务器地址错误 发布:2025-07-02 00:33:22 浏览:278
本田思域2021款买哪个配置 发布:2025-07-02 00:31:43 浏览:326
安卓十二系统什么时候更新 发布:2025-07-02 00:12:28 浏览:346
shell脚本需要编译链接 发布:2025-07-02 00:04:20 浏览:475