当前位置:首页 » 编程语言 » 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,效率慢多了.

热点内容
androidsdk32下载 发布:2025-08-24 16:36:35 浏览:266
安卓手机忘了解锁密码怎么办 发布:2025-08-24 16:35:09 浏览:789
存储过程在java代码 发布:2025-08-24 16:32:11 浏览:498
写编译器需要哪些知识 发布:2025-08-24 16:09:06 浏览:330
数据库的关系符号 发布:2025-08-24 16:02:29 浏览:626
sqlserver表值函数 发布:2025-08-24 15:56:27 浏览:554
linuxc内存泄露 发布:2025-08-24 15:54:30 浏览:112
python读取文件每一行 发布:2025-08-24 15:32:27 浏览:83
abbplc编程软件 发布:2025-08-24 15:31:43 浏览:209
苹果关闭密码如何设置新密码 发布:2025-08-24 14:28:41 浏览:299