交集並集差集

2021-09-25 04:01:18 字數 1080 閱讀 8709

1、

--內連線

select * from student a inner join sc b

on a.sno=b.sno

---左連線

select * from student a left join sc b

on a.sno=b.sno

----差集

select sno from student

except

select sno from sc

---交集

select sno from student

intersect

select sno from sc

---並集

select sno from student

union

select sno from sc

*************************===

---兩個金額之間的區間(開始金額為1,結束金額7)

---bmoney和emoney查詢值,1和7是賦值

(bmoney>='1' and (bmoney<='7' or emoney<='7' ))

or (bmoney<='1' and emoney>='1')

------

----sql求兩金額區間

go use test

declare @b int

declare @e int

declare @b1 int

declare @e1 int

set @b=2

set @e=8

set @b1=1.8

set @e1=11

if( (@b>=@b1 and (@b<=@e1 or @e<=@e1))

or (@b<=@b1 and @e>=@b1)

)begin

print '在區間內'

endelse

begin

print '不在區間內';

endgo

shell bash 交集 並集 差集

方法一 直接用檔名 取兩個文字檔案的並集 交集 差集 並 sort m sort file1 uniq sort file2 uniq uniq 交 sort m sort file1 uniq sort file2 uniq uniq d 差 file1 file2 sort m sort fil...

PHP 交集 並集 差集

array flip array splice 並集 array merge 過濾 array filter 去重 array unique 差集 array diff array diff 函式返回兩個陣列的差集陣列。該陣列包括了所有在被比較的陣列中,但是不在任何其他引數陣列中的鍵值。a1 arr...

python List交集 並集 差集

工作中遇到了求兩個集合的差集,但是集合集合中包含字典,所以使用difference方法會報錯,看了一些別人的部落格,整理了一下。1.獲取兩個list 的交集 print list set a intersection set b 2.獲取兩個list 的並集 print list set a uni...