pl sql 過濾,排序,帥選資料小練習02

2021-09-14 04:42:27 字數 1575 閱讀 7316

--1.查詢工資大於12000的員工的姓名和工資

select last_name,salary

from employees

where salary > 12000

--2,查詢員工工號為176的員工的姓名和部門

select last_name,department_id

from employees

where employee_id = 176

--3,選擇工資不在5000到12000的員工姓名和工資

select last_name,salary

from employees

--where salary<5000 or salary >12000

where salary not between 5000 and 12000

--4,選擇僱傭時間在1998-02-01到1998-05-01之間的員工的姓名,job_id和僱傭時間

select last_name,job_id,hire_date

from employeees

--where hire_date between '1-2月-1998' and '1-5月-1998'

where to_char(hire_date,'yyyy,mm,dd') between '1998-02-01' and '1998-05-01'

--5,選擇在20號或在50號部門工作的員工姓名和部門的門號

select last_name,department_id

from employees

where department_id = 20 or department_id = 50

--where department_id (20,50)

--6,選擇在2023年僱傭的員工的姓名和僱傭時間

select last_name,hire_date

from employees

--where hire_date like '%94'

where to_char(hire_date,'yyyy')='1994'

--7,選擇公司中沒有管理者的員工姓名及job_id

select last_name,job_id

from employees

where maneger_id is null

--8,選擇公司中有獎金的員工姓名,工資和獎金級別

select last_name,salary,commission_pct

from employees

where commiddion_pct is not null

--9,選擇姓名中有字母a,和e的員工姓名

select last_name

from employees

where last_name like '%a%e%' or lasr_name like '%e%a%'

--10,選擇姓名的第三個字母是a的員工姓名

select last_name

from employees

where last_name like '__a%'

過濾和排序資料

基本語法 select from tablename where column operator condition operator 比較運算 等於 不是 大於 大於等於 小於 小於等於 不等於 也可以是 關鍵字 between and 介於兩值之間。in 在集合中 notin 不在集合中 lik...

ORACLE SQL過濾和排序資料

在查詢過濾行就是查詢你需要的內容和資料,並進行排序 但是我們過濾的過程中需要的語句是 where where語句是緊隨 from 子句 例如 select sno,sname,sbirthday from student where sname 曾華 紅色部分不論是數字和日期都可以過濾 但是字元和日...

使用CoreData查詢資料 謂詞過濾,排序操作

主要是對於nspredicate的介紹 一 nspredicate的基本語法 二 使用coredata查詢資料 謂詞過濾,排序操作 一 nspredicate的基本語法 nspredicate類是用來定義邏輯條件約束的獲取或記憶體中的過濾搜尋。可以使用謂詞來表示邏輯條件,用於描述物件永續性儲存在記憶...