當前位置:首頁 » 編程語言 » 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,效率慢多了.

熱點內容
存儲卡不顯示盤符怎麼辦 發布:2025-10-16 22:24:15 瀏覽:514
python列表轉集合 發布:2025-10-16 22:09:35 瀏覽:963
jsrsa公鑰加密 發布:2025-10-16 22:01:17 瀏覽:429
四平地區dns伺服器ip 發布:2025-10-16 21:39:55 瀏覽:619
4huftp 發布:2025-10-16 21:34:03 瀏覽:644
有哪些好玩又配置低的電腦游戲 發布:2025-10-16 21:34:02 瀏覽:816
安卓的怎麼鎖屏 發布:2025-10-16 21:32:46 瀏覽:210
python項目編譯成exe 發布:2025-10-16 21:26:16 瀏覽:28
手機版我的世界伺服器怎麼變得不卡 發布:2025-10-16 21:04:17 瀏覽:967
dp源碼輸出 發布:2025-10-16 21:02:42 瀏覽:7