Oracle 運算符

2022-03-09 17:45 更新


Oracle 算術運算符包括+、-、*、/四個,其中/獲得的結果是浮點數(shù)。

案例1、求2018年上學期數(shù)學的平均成績。

select a.*, b.coursename, c.stuname
from score a, course b, stuinfo c
where a.courseid = b.courseid
  and a.stuid = c.stuid;

select b.coursename, sum(a.score) / count(1)
from score a, course b
where a.courseid = b.courseid
  and a.courseid = 'R20180101'
group by b.coursename;

Oracle關系運算符

Oracle 關系運算符在 where 條件語句當中經(jīng)常使用到,常用的關系如下:

符號 解釋 符號 解釋
= 等于 <>或者!= 不等于
> 大于 >= 大于或者等于
< 小于 <= 小于或者等于

Oracle邏輯運算符

Oracle 的邏輯運算符有三個:ANDOR、NOT。

案例2、查看2018年上學期數(shù)學成績在85-95分之間的同學:

select a.*,b.coursename,c.stuname
    from score a,course b,stuinfo c
where a.courseid=b.courseid
    and a.stuid=c.stuid and a.score>='85'and a.score<='95'


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號