第十一節 sql語句 比較運算子 等

2022-08-17 21:45:16 字數 1171 閱讀 4593

view code

--比較運算子:=、!=、、>=子查詢結果必須為個

--如果子查詢結果大於,請使用in關鍵字

select*from stuinfo where id in

(select stuid from stumark where writtenexam=60

)--查詢參加考試的學生資訊

select*from stuinfo where id in

(select stuid from

stumark)

--查詢未參加考試的學生資訊

select*from stuinfo where

id notin

(select stuid from

stumark)

--如果exists括號內的子查詢有結果為true否則為false

ifexists(

select*from stumark where writtenexam>80

)begin

update stumark

set writtenexam=writtenexam+2

where writtenexam+2

<=100

endelse

begin

update stumark

set writtenexam=writtenexam+5

where writtenexam+5

<=100

endselect*from

stumark

go--not exists

ifnotexists(

select*from

stumark

where writtenexam>60 and labexam>60

)begin

update stumark

set writtenexam=writtenexam+3

, labexam=labexam+3

endelse

begin

update stumark

set writtenexam=writtenexam+1

, labexam=labexam+1

endselect*from

stumark

go

第十一章運算子過載

1 運算子過載 include using namespace std class num num int get const void set int x private int n int main num int get const void set int x void add privat...

(一二二)運算子過載 第十一章

本章重點是類設計技術,而不是通用原理。c 的重點是 多使用。運算子過載是一種形式的c 多型 就像函式過載那樣,同名但呼叫不同的函式 要過載運算子,需要使用被稱為運算子函式的特殊函式形式。運算子函式格式如下 operator 運算子 argument list 例如 operator 表示過載加號運算...

C 程式語言 第十一章 運算子過載

1 運算子函式 運算子函式的名字是由關鍵字operator後跟對應的運算子構成。二元運算子可以定義為取乙個引數的非靜態成員函式,也可以定義為去兩個引數的非成員函式。乙個運算子函式必須或者是乙個成員函式,或者至少有乙個使用者定義型別的引數。不存在運算子遮蔽,這就保證了內部運算子可以用,並且為運算子定義...