Oracle 基礎之二

2021-09-30 19:45:13 字數 2038 閱讀 3603

執行三:select [ ] *|列名稱 【列】,列名稱【列】,…

執行一:from 表名稱 [別名]

執行二:where 過濾條件…

限定符號:

查詢工資大於2000的人員:

select * 

from emp

where sal>2000;

查詢allen的資訊

secelt *

from emp

where ename = 'allen'

allen 因為是內容,所以需要大小寫區分;

select *

from emp

where sal=3000

3000不需要帶引號

select  empno,ename,job

from emp

where job !='salesman';

查詢職位不是銷售人員的雇員編碼,姓名和職位

方法2

select  empno,ename,job

from emp

where job <>'salesman';

查詢工資在2000到3000的雇員資訊

select

from emp

where sal>2000 and sal<3000;

查詢工資大於2000或者職位是辦事員的所有雇員資訊

條件一:工資大於2000,sal>2000

條件二:職位是辦事員job=『clerk』

關係:其中之一,or

select *

from emp

where sal>2000 or job ='clerk';

二者一樣:

select * from emp where not sal>=2000;

select * from emp where sal<2000;

between 最小值(日期,數字)adn 最大值 備註:最大值最小值都包含的

二者一樣下面但是第二種比第一種優化:

select * from emp where  sal>=2000 and sal <=3000;

select * from emp where sal between 2000 and 3000;

日期格式:1981-12-31,為第一種』31-12月-81』,『31-12月-1981』

select * from emp where comm is not null; 代表領取佣金的人員資訊

select * from emp where not comm is null; 跟上面一樣

in操作符類似於between …and …給的是大範圍,但是in是小範圍的

between 1 and 4,,意思是1-4的範圍

in (1,3),代表取1,3的值

指定查詢的時候用in是最簡短的

select * from emp where empno not in (7369,7566,7788,9999);

select * from emp where not empno in (7369,7566,7788,9999);

關於not in 與 null的問題

在使用not in 進行範圍判斷的時候,如果範圍裡面包含有null,那麼不能使用

例如:使用in操作做包含null—沒有任何影響

select from emp where empno in (7369,7566,7788,null)

但是使用not in的操作中包含null;

select *from emp where empnonot in(7369,7566,7788,null)

使用not in null的時候相當於查詢了所有的資料,資料量大基本伺服器崩盤了。

不知道就去學習集合理論

使用like的時候可以使用二個萬用字元

swift基礎之《二》

型別安全,swift中不支援隱式轉換 var c 100 var c1 100.85 let res c c1 總結 swift 中不同資料型別,不能賦值和運算 迴圈語句 for in for while dowhile var sum 1 100 while sum 1 50 do while r...

python基礎之二

1.元組 tuple tuple 元素1,元素2,建立元組 tuple 建立空元組,只需要一堆空的圓括號即可注 建立單元素元組時,元素後的逗號不可少,不加逗號則無法區分是元組還是表示式。tuple m n 其中m,n可以是0 正整數 負整數,包括索引為m的元素,但不包括索引為n的元素a,b,c,d ...

C 基礎之二

c 基礎之二 1 靜態字段 靜態成員 由該類的所有例項共享,其變化,例項是對所有可見。2 宣告為static有 場 方法 屬性 建構函式 運營商 事件。3 不同的常量靜態量 位置,在編譯時被編譯器替換。4 類屬性與類字段不同 屬性是乙個函式成員,它不為資料儲存分配記憶體並執行 5 屬性get訪問器的...