1. 程式人生 > 資訊 >十銓釋出新款 RGB 一體式水冷散熱器,同時覆蓋 CPU 和 SSD

十銓釋出新款 RGB 一體式水冷散熱器,同時覆蓋 CPU 和 SSD

進入DOS按: win+R 輸入sqlplus 回車
username: sys as sysdba 回車
password : 密碼為空不寫直接回車
檢查當前登入的使用者: show user

連線命令

(1)conn[ect]
用法: conn 使用者名稱/密碼@網路服務名 [as sysdba/sysoper]
當用特權使用者身份連線時,必須帶上 as sysdba 或是 as sysoper
案例: conn scott/123456
(2)disc[onnect]
說明:該命令用來斷開與當前資料庫的連線
(3)passw[ord]此命令只適用於SYSTEM
說明:該命令用於修改使用者的密碼.如果要想修改其它使用者的密碼,需要用sys/system登陸.
(4)show user
說明:顯示當前使用者名稱
(5)exit
說明:該命令會斷開與資料庫的連線,同時會退出sql*plus
修改許可權設定一般情況下使用dba使用者

修改使用者密碼:

語法:alter user 使用者名稱 identified by 新密碼;
案例:alter user system identified by 123456;
鎖定使用者
語法:alter user 使用者名稱 account lock;
案例:alter user scott account lock;
解除鎖定
語法:alter user 使用者名稱 account unlock;
案例:alter user scott account unlock;
顯示和設定環境變數
概述:可以用來控制輸出的各種格式。
(1)linesize
說明:設定顯示行的寬度,預設是80個字元
sql>show linesize 顯示寬度
sql>set linesize 90 設定寬度
(2)pagesize
說明:設定每頁顯示的行數目,預設是14,用法和linesize一樣。
至於其它環境引數的使用也是大同小異

Spool c:/筆記.txt
Spool off (結束)
“/”執行上一條語句
Edit(修改錯誤的語句)修改完成輸入“/”執行
“--”單行註釋
/**/多行註釋
查看錶結構:desc emp(常用)
清屏 host cls
set timing on/off(on表示開啟Oracle中語句執行時間的計算)
管理員使用者使用普通使用者的表
語法: select * from 使用者名稱.表名

建立使用者:(管理員)

語法:create user 使用者名稱 identified by 密碼
案例: create user scxh identified by 123456;
備註: 新建立的使用者,沒有任何的許可權,包括登入都沒有
給使用者修改密碼
概述:如果給自己修改密碼可以直接使用
sql>password 使用者名稱
如果給別人修改密碼則需要具有dba的許可權,或是擁有alter user的系統許可權
sql>alter user 使用者名稱 identified by 新密碼

建立使用者案例

例子: sql> create user dongshao identified by m123
default tablespace users
temporary tablespace temp
quota 3m on users;
identified by 表明該使用者dongshao 將用資料庫方式驗證
default tablespace users //使用者的表空間在users上
temporary tablespace temp //使用者dongshao的臨時表健在temp 空間
quota 3m on users //表明使用者dongshao 建立的資料物件(表,索引,檢視,pl/sql塊..)最大隻能是3m
剛剛建立的使用者是沒有任何許可權的,因此,需要dba給該使用者授權.
sql>grant connect to dongshao
如果你希望該使用者建表沒有空間的限制
sql>grant resource to dongshao
如果你希望該使用者成為dba
sql>grant dba to dongshao
刪除使用者
概述:一般以dba的身份去刪除某個使用者,
如果用其它使用者去刪除使用者則需要具有 drop user的許可權。
比如 drop user 使用者名稱 【cascade】
案例: drop user scxh cascade;
cascade: 如果這個使用者下面建立了表,則使用這個

System給東少許可權時
Grant connect to dongshao with admin option
create session:登入
create table :建立表
create view:試圖
1.建立2個使用者
Create user dongshao1 identified by 123456;
Create user dongshao2 identified by 123456;
2.給dongshao1這個使用者新增許可權,並且讓其可以繼續授予其他使用者的許可權
grant create session,create table to dongshao1 with admin option;
grant create view to dongshao1;
3.使用dongshao1使用者給dongshao2使用者授權.
grant create session,create table to dongshao2 with admin option;
4.使用dongshao1使用者給dongshao2授權檢視許可權的時候,會提示許可權不足
grant create view to dongshao2;
5.回收許可權
revoke create session from dongshao1; --這個是冬哥哥

1.建立兩個使用者 qq , tt.初始階段他們沒有任何許可權,如果登陸就會給出錯誤的資訊
1.1建立兩個使用者,並指定密碼.

2.給使用者qq授權:
2.1:授予create session 和create table許可權時 帶with admin option

2.2 授予create view 時不帶with admin option

物件許可權;

給使用者設定物件許可權
grant 許可權 on 物件 to 使用者名稱 with grant option
grant select on emp to monkey

設定使用者訪問許可權更加精細控制.(授予列許可權)
語法: grant update on 表名(列名稱) to 使用者名稱
案例: grant update on emp(sal) to monkey;

建立角色

㈠建立角色(不驗證)
如果角色是公用的角色,可以採用不驗證的方式建立角色.
語法:create role 角色名 not identified;
案例:create role mydongshao1 not identified; 沒有任何許可權

㈡建立角色(資料庫驗證)
語法:create role 角色名 identified by 口令
案例:create role 角色名 identified by dongshao

profile

指定scott這個使用者最多隻能嘗試3次登陸,鎖定時間為2天,讓我們看看怎麼實現
建立profile檔案
語法:create profile pro名稱 limit failed_login_attempts 3次 password_lock_time 2天;
sql> create profile lock_account limit failed_login_attempts 3 password_lock_time 2;
給使用者設定profile
語法: alter user 使用者 profile pro名稱;
sql> alter user scott profile lock_account;

建立表:

語法:
create table 表名(
欄位名稱1 欄位型別,
欄位名稱2 欄位型別
...
)

建立一個表,對這個表進行CRUD
案例: 建立一個wwdz,然後對這個進行表增刪改查
create table wwdz(
id number, --編號
name varchar2(20), --姓名
tel char(11), --電話
datetime date default sysdate --時間
);

查詢表中的所有資料

語法: select * from 表名
案例: select * from wwdz
對wwdz這個表新增一條資料
語法: insert into 表名(欄位名稱1,欄位名稱2,欄位名稱3,...) values(值1,值2,值3,...);
案例: insert into wwdz(id,name,tel) values(2,'還厲害哦',12312312312);
案例: insert into wwdz(id,name,tel) values(2,'還厲害哦','12312312312');
案例: insert into wwdz(id,name,tel) values('三','你真的很厲害哦','12312312312'); 錯誤的
修改wwdz表中的某一行資料
語法: update 表名 set 欄位名稱1=值1,欄位名稱2=值2 備註: 如果執行這個語句,整個表都將被修改(慎用)
語法: update 表名 set 欄位名稱1=值1,欄位名稱2=值2 where 條件
案例: 修改編號2這個使用者的電話號碼為:13888888888,姓名: 方誌華
案例: update wwdz set name='方誌華',tel=138888888888 where id=2;
刪除wwdz表中某一條資料
語法: delete from 表名 如果執行這個語句,整個表的資料都沒有了(慎用)
語法: delete from 表名 where 條件
案例: delete from wwdz where id=3;
刪除表:
語法:drop table 表名
案例:drop table wwdz

表:
語法:
create table 表名(
欄位1 型別1,
欄位2 型別2,
)
新增
insert into 表名(欄位1,欄位2) values(值1,值2,)
修改
update 表名 set 欄位1=值,欄位2=值 where 條件
刪除:
delete from 表名 where 條件
查詢:
查詢表中的所有資料:select * from 表名
帶條件查詢: select * from 表名 where 條件
單獨查詢指定欄位: select 欄位1,欄位2,... from 表名 where 條件

varchar2(20) 變長
char(20) 定長
字元型別,並且長度為20字元(10箇中文)
面試題: 請問varchar2和char之間有什麼區別? 誰的查詢速度更快
答: varchar2是變長,儲存的值實際的長度,但是char是定長,如果儲存的值沒有達到
指定的長度,則使用空格填充,反之超出則會報錯(自動擷取到指定長度然後儲存)
char的查詢速度比varchar2更快,因為在進行查詢的時候char不需要計算長度直接
進行對比,而varchar2首先進行長度的計算,然後在進行值的查詢.
number : 數值
語法: number(p,s)
案例: number(5,2);
解釋: 代表數值型別,有五個有效位,兩個小數位(最大位:999.99)

子查詢建立表
根據一個表來建立另外的一個表:(表結構和表內容一起被複制)
語法: create table 新表名 as select * from 舊錶名
案例: create table dongshao as select * from emp;
檢視結果: select * from dongshao;

只複製表的結構
語法:create table 新表名 as select * from 舊錶名 where 1=2
案例:create table dongge as select * from emp where 1=2
檢視結果:select * from dongge;
檢視結構: desc dongge;

複製表內容(將一個原有表中的資料,複製到另一個表中,不指定欄位,全部複製)
語法:insert into 目標表 select * from 原表
案例:insert into dongge select * from emp
檢視結果: select * from dongge;

複製表內容(將一個原有表中的資料,複製到另一個表中,並且指定欄位)
語法:insert into 目標表(欄位1,欄位2) select 欄位1,欄位2 from 原表
案例:insert into tongzhai(id,name) select empno,ename from emp
建立一個tongzhai表
create table tongzhai(
id int,
name varchar(30)
)
檢視結果
select * from tongzhai;

mysql命令
檢視所有的資料庫
show databases;
檢視所有的表
show tables;
建立資料庫
create database 庫名
在mysql中建立emp表
create table emp(
empno int,
ename varchar(20),
job varchar(20),
mgr int,
hiredate Date,
sal double(7,2),
comm double(7,2),
deptno int
)
desc emp;

INSERT INTO EMP VALUES (7369, 'SMITH', 'CLERK', 7902, '1980-12-17', 800, NULL, 20);
INSERT INTO EMP VALUES (7499, 'ALLEN', 'SALESMAN', 7698, '1981-02-20', 1600, 300, 30);
INSERT INTO EMP VALUES (7521, 'WARD', 'SALESMAN', 7698, '1981-02-22', 1250, 500, 30);
INSERT INTO EMP VALUES (7566, 'JONES', 'MANAGER', 7839, '1981-04-02', 2975, NULL, 20);
INSERT INTO EMP VALUES (7654, 'MARTIN', 'SALESMAN', 7698, '1981-09-28', 1250, 1400, 30);
INSERT INTO EMP VALUES (7698, 'BLAKE', 'MANAGER', 7839, '1981-05-01', 2850, NULL, 30);
INSERT INTO EMP VALUES (7782, 'CLARK', 'MANAGER', 7839, '1981-06-09', 2450, NULL, 10);
INSERT INTO EMP VALUES (7788, 'SCOTT', 'ANALYST', 7566, '1987-04-19', 3000, NULL, 20);
INSERT INTO EMP VALUES (7839, 'KING', 'PRESIDENT', NULL, '1981-11-17', 5000, NULL, 10);
INSERT INTO EMP VALUES (7844, 'TURNER', 'SALESMAN', 7698, '1981-09-08', 1500, 0, 30);
INSERT INTO EMP VALUES (7876, 'ADAMS', 'CLERK', 7788, '1987-05-23', 1100, NULL, 20);
INSERT INTO EMP VALUES (7900, 'JAMES', 'CLERK', 7698, '1981-12-03', 950, NULL, 30);
INSERT INTO EMP VALUES (7902, 'FORD', 'ANALYST', 7566, '1981-12-03', 3000, NULL, 20);
INSERT INTO EMP VALUES (7934, 'MILLER', 'CLERK', 7782, '1982-01-23', 1300, NULL, 10);

select * from tongzhai;
insert into tongzhai(id) values(1);
desc tongzhai

修改表結構

追加新列
語法:alter table 表名 add 欄位名 型別;
案例:alter table tongzhai add age tinyint;
tinyint: 範圍: -128到127
修改列
語法:alter table 表名 modify 欄位名 型別;
案例:alter table tongzhai modify age int;

修改預設值的設定:
語法:alter table 表名 modify 欄位名 型別 default 預設值;
案例:alter table tongzhai modify age int default 11;

刪除列(不要輕易刪除一個欄位)
語法:alter table 表名 drop column 欄位名
案例:alter table dongshao drop column address

重新命名列
語法:alter table 表名 rename column 舊名稱 to 新名稱
案例:alter table dongshao rename column name to a_name

修改表的名稱(表的名稱也不要修改)
語法:rename 舊錶名 to 新表名;
案例:rename student2 to do;

約束

建立約束:
語法:
create table 表名(
欄位名稱 欄位型別 constraint 約束名稱 約束
欄位名稱 欄位型別 constraint 約束名稱 約束 約束
......
)
案例:
create table myperson(
id varchar2(18) constraint myperson_PK primary key, --primary key主鍵約束
name varchar2(40) constraint myperson_Name_notnull not null, --not null不能為空
gender varchar2(4) constraint myperson_Gender check (gender in ('男','女')), --check查驗
email varchar2(40) constraint myperson_Email_unique unique --unique唯一
constraint myperson_Email_notnull not null, --not null不能為空
deptno number constraint myperson_FK references dept(deptno) ON DELETE CASCADE
--references外來鍵約束
);

刪除約束:
語法:alter table 表名 drop constraint 約束名稱;
案例:alter table myperson drop constraint myperson_PK;

給列新增約束
語法:alter table 表名 add(constraint 約束名稱 約束(欄位))
案例:alter table dongge add(constraint pk_id primary key(id))

建立一個表
create table bb(
id number primary key,
name varchar2(20) default '成都新華高階技工學校',
age number(2) not null,
zhc varchar2(20) default '' not null,
status number, --1: 正常,0:非正常
create_time number --時間戳:1232654553 時間:'2022-12-12 12:12:12'
)

課堂抽查

  1. 建立一個表,要求有(編號,姓名,性別,時間,年齡,電話,描述)
    create table db(
    id number,
    name varchar2(20),
    sex varchar(2),
    time date,
    nianling varchar(2),
    tel char(11),
    miaosu varchar(40));

  2. 給表中的編號設定主鍵約束
    alter table db add(primary key(id));

  3. 給表中的姓名設定不能為空
    alter table db modify name not null;

  4. 給表中的性別設定只能選擇男或者女
    alter table db add(constraint xb check(sex='男' or sex='女'));

  5. 給表中的時間設定預設為系統時間
    alter table db modify time default sysdate;

  6. 給表中的年齡設定一個範圍18--22之間
    alter table db add(constraint nianling_check check(nianling>=18 and nianling<=22));
    alter table db drop constraint nianling_check;
    alter table db add(constraint nianling_check check(nianling between 18 and 22));

  7. 給表中的電話設定唯一
    alter table db modify tel unique;

新增表註釋
語法:comment on table 表名 is '註解名稱';
案例:comment on table student is '學生表';
新增每個欄位的註釋
語法:comment on column 表名.欄位名稱 is '註解名稱';
案例:comment on column db.tel is '電話號碼';

新增語句:
語法1: insert into 表名(欄位1,欄位2,..) values(值1,值2,..) 欄位和值一一對應
語法2: insert into 表名 values(值1,值2,..) 一一對應

插入之前改變日期表示式的方法:(日-月-年) '15-3月-2022' '2022-03-15'
alter session set nls_date_format='yyyy-mm-dd';
插入資料時修改時間表達式
insert into emp(empno,hiredate) values(9527,to_date('1990-02-03','yyyy-mm-dd'));

修改資料
語法: update 表名 set 欄位=值,欄位=值 where 條件

刪除
語法: delete from 表名 where 條件

查詢

查詢表中所有資料
select * from 表名
查詢表中指定列
select 列1,列2,.. from 表名
根據條件查詢指定的資料
select * from 表名 where 條件
where: 條件查詢,根據指定的條件進行查詢
emp表中的欄位的解釋
EMPNO : 編號
ENAME : 姓名
JOB : 職位
MGR : 領導的編號
HIREDATE : 入職日期
SAL : 工資
COMM : 獎金
DEPTNO : 部門編號

  1. 請查詢出emp表中員工的姓名,工資和獎金
    select ename,sal,comm from emp;
  2. 請查詢出emp表中部門編號為20的所有員工
    select * from emp where deptno=20;

?顯示每個僱員的年工資
select sal12 from emp;
使用列的別名: as 設定別名
語法: select 欄位 as 別名 from 表名;
語法: select 欄位 別名 from 表名;
select sal
12 as "年薪" from emp;
select sal12 "年薪" from emp;
select sal
12 year_money from emp;
如何處理null值
select ename,(sal12)+comm from emp; 這裡我們使用年薪+null = null
使用nvl函式來處理
語法: nvl(欄位,預設): 如果欄位不為null,則使用欄位的值,否則使用預設值(預設值為自定義)
語法案例:select nvl(欄位名稱,預設值) from emp;
sql案例:select ename,(sal
12)+nvl(comm,0) from emp;
如何連線字串(||)(輸出: XXX姓名的工資的多少)
語法: 欄位名稱 || 欄位名稱
select ename||'的薪資為:'||sal from emp;
select ename||sal from emp;
?如何顯示某人是什麼崗位
select ename,job from emp where ename='黃木城';
使用where子句
?如何顯示工資高於3000的員工
select * from emp where sal >= 3000;
?如何查詢1982.1.1後入職的員工
select * from emp where hiredate >= '1982';
?如何顯示工資在2000到3000的員工情況
select * from emp where sal >= 2000 and sal <= 3000;
between——在某個範圍:
語法: 欄位名稱 between 起始值 and 結束值
select * from emp where sal between 2000 and 3000;
?如何顯示工資不在2000到3000的員工情況
select * from emp where sal not between 2000 and 3000;
?查詢SMITH 的薪水,工作,所在部門
select ename,sal,job,depeno from emp where ename='SMITH';
1、distinct——過濾掉多餘的重複記錄只保留一條
select distinct deptno from emp; 這裡,distinct deptno會過濾掉重複的deptno
select distinct comm from emp; distinct也可以過濾掉重複的null,或者說如果有多個null,只輸出一個
select distinct comm, deptno from emp; 把comm和deptnor的組合進行過濾
select deptno, distinct comm from emp; 邏輯上有衝突
select ename, * from emp; 這個在SqlServer里正確,在Oracle裡不正確

in和null

in(屬於若干個孤立的值)
語法: 欄位 in(值1,值2,值3);: 如果沒有查詢到,則返回空,不顯示
語法: 欄位 not in(值1,值2,值3);: 不在這個範圍內的所有資料
案例: empno in(6666,7777,8888,9999)
表案例: select * from emp where ename in('大哥','黃木城');
資料庫中的 and和&&一個意思 or和||一個意思
表案例: select * from emp where ename='大哥' or ename='黃木城';
表案例: select * from emp where empno in(6666,7777,8888,9999);
不在這個範圍內的所有資料 not in
表案例: select * from emp where empno not in(6666,7777,8888,9999);

null 空 ,沒有值
零和null是不一樣的,null表示空值,沒有值;零表示一個確定的值
null不能參與如下運算:<> != =
null可以參與如下運算:is is not
語法: select * from 表名 where 欄位 is null
語法: select * from 表名 where 欄位 is not null

select * from emp where comm <> null; --錯誤
select * from emp where comm != null; --錯誤
select * from emp where comm is not null; --正確

select * from emp where comm = null; --錯誤
select * from emp where comm is null; -- 正確

select * from emp where comm is null; --輸出獎金為空的員工的資訊
select * from emp where comm is not null; --輸出獎金不為空的員工的資訊

思考:如何顯示沒有上級的僱員的情況
select * from emp where mgr is null;

order by: 排序

如果不指定排序的標準,則預設是升序,升序用asc表示,預設可以省略不寫,降序用desc表示
為一個欄位指定的排序標準並不會對另一個欄位產生影響
強烈建議為第一個欄位都指定排序的標準
語法: select * from 表名 order by 欄位 asc; 預設為升序asc(可以不寫)
語法: select * from 表名 order by 欄位1,欄位2; 都是升序
語法: select * from 表名 order by 欄位1,欄位2 desc; 先升後降
語法: select * from 表名 order by 欄位1 desc, 欄位2; 先降後升
語法: select * from 表名 order by 欄位1 desc, 欄位2 desc; 都降
備註: 在進行排序時,如果設定了多個,當第一個有相同排序時,則繼續執行第二排序規則

模糊查詢 like

語法:
select * from 表名 where 欄位 like '%值%'; 匹配帶有該值的所有欄位的值
select * from emp where ename like '%S%'; 匹配ename欄位所有值中帶有S的名字

select * from 表名 where 欄位 like '值%'; 匹配以該值開頭的所有欄位的值
select * from emp where ename like 'S%'; 匹配ename欄位以S開頭的所有欄位值

select * from 表名 where 欄位 like '%值'; 匹配以該值結尾的所有欄位的值
select * from emp where ename like '%S'; 匹配ename欄位以S結尾的所有欄位值

何波提問: 萬一別人的名稱裡面就有'_'怎麼辦??
select * from 表名 where 欄位 like '值%'; 第一個''佔位符,查詢欄位值的第二個值相同的欄位值
select * from 表名 where 欄位 like '_S%'; 匹配ename第二個值為s的所有欄位值

select * from 表名 where 欄位 like '__值%'; 前兩個'_'佔位符,查詢欄位值的第三個值相同的欄位值
select * from emp where ename like '__S%'; 匹配ename第三個值為s的所有欄位值

思考:在 emp 表中查詢工資高於500或是崗位為MANAGER的僱員,
同時還要滿足他們的姓名首字母為大寫的 J。

select * from emp where sal>500 or job='MANAGER' and ename like 'J%';

1.找出佣金高於薪金的僱員
select * from emp where comm>sal;
2.找出佣金高於薪金60%的僱員
select * from emp where comm>sal*0.6;
3.找出部門10中所有經理和部門20中的所有辦事員的詳細資料
select * from emp where (job='MANAGER' and deptno='10') or (job='CLERK' and deptno='20');
4.顯示不帶有'R'的僱員姓名
select * from emp where ename not like '%R%';
5.顯示僱員姓名,根據其服務年限,將最老的僱員排在最前面
select ename,hiredate from emp order by hiredate;
6.顯示所有僱員的姓名、工作和薪金,按工作的降序順序排序,而工作相同時按薪金升序
select ename,job,sal from emp order by job desc,sal;

資料分組-max,min,avg,sum,count

AVG(欄位) 數字表達式中所有值的平均值
SUM(欄位) 表示式中所有值的和
COUNT(欄位) 表示式中值的個數
COUNT(*) 統計總條數
MAX(欄位) 表示式中的最高值
MIN(欄位) 表示式中的最低值

?如何顯示所有員工中最高工資和最低工資
select max(sal),min(sal) from emp;
?顯示所有員工的平均工資和工資總和
select avg(sal),sum(sal) from emp;
?計算共有多少員工
select count(*) from emp;
擴充套件要求:
?請顯示工資最高的員工的名字,工作崗位
???想想應該怎麼寫
?請顯示工資高於平均工資的員工資訊
這個我也不會?????

分組: 面試題哦!
group by 和 having子句
group by用於對查詢的結果分組統計,
having子句用於限制分組後顯示結果.

查詢出emp表中有哪些職位
select * from emp order by job;
select job from emp group by job;
select distinct job from emp;

select comm from emp group by comm;

?如何顯示每個部門的平均工資和最高工資
select deptno,max(sal) ,avg(sal),sum(sal) from emp group by deptno;
?顯示每個部門的每種崗位的平均工資和最低工資
select job,max(sal) ,avg(sal),min(sal) from emp group by job;
?顯示平均工資低於2000的部門號和它的平均工資
select avg(sal),deptno from emp group by deptno having avg(sal) < 2000 ;
擴充套件要求:
顯示工資低於2000,部門平均工資低於1000的部門號和部門平均工資
select deptno,avg(sal) from emp where sal<2000 group by deptno having avg(sal)<1000;

笛卡爾集:

語法: select * from 表名1,表名2 where 條件(條件是兩個表都滿足的情況下)
顯示所有員工的姓名,工資,部門號和部門名稱

  1. 根據兩個表中的deptno條件進行比對查詢出所有的資料
    select * from emp,dept where emp.deptno=dept.deptno;
    select emp.ename,emp.sal,emp.deptno,dept.dname from emp,dept where emp.deptno=dept.deptno;
    select a.ename,a.sal,b.deptno,b.dname,b.LOC from emp a,dept b where a.deptno=b.deptno;
    ?顯示SCOTT使用者,工資及所在部門的名字 【笛卡爾集】
    結果:
    eanme sal dname
    SCOTT 3000.00 RESEARCH
    select a.ename,a.sal,b.deptno,b.dname,b.LOC from emp a,dept b
    where a.deptno=b.deptno and a.ename='SCOTT';

?查詢僱員姓名,工資以及工資等級
select e.ename, e.sal, s.grade from emp e,salgrade s
where e.sal between s.losal and s.hisal;

?如何顯示部門號為10的部門名、員工名和工資
select d.dname,e.ename,e.sal from emp e,dept d where e.deptno=d.deptno and e.deptno=10;
擴充套件要求:
?顯示僱員名,僱員工資,工資等級及所在部門的名字,並按部門排序.
select e.ename,e.sal,s.grade from emp e,dept d,salgrade s where
(e.sal between s.losal and s.hisal)and e.deptno=d.deptno order by d.dname;