WHERE條件查詢

where可以指定查詢條件,如果是指定字符型字段查詢條件,形式爲字段名,運算符'字符串'如果是指定數字型字段查詢條件,形式爲字段名 運算符 數值串。like和not like 適合字符型字段的查詢。
 
select * from 成績表 where 學號='20020001'     (字符型字段)
 
select * from 成績表 where 課程成績=97          (數值型字段)
 
select * from 成績表 where 學號 !='20020001'
 
select * from 成績表 where 課程成績 <> 97
 
select * from 成績表 where 課程成績<97
 
select * from 成績表 where 課程成績>97
 
select * from 成績表 where 課程成績<=97
 
select * from 成績表 where 課程成績>=97
 
select * from 成績表 where 課程成績 !<97
 
select * from 成績表 where 院系名稱 in ('計算機','物理')
 
select * from 成績表 where 院系名稱 not in ('計算機','物理')
 
select * from 成績表 where 課程學分 in ('2','3')
 
select * from 成績表 where 課程代號 between ('2002030001' and '2002030004')
 
select * from 教學表 where 姓名 like '張%'
 
select * from 教學表 where 姓名 like '張_'             匹配模式
 
select * from 教學表 where 姓名 not like '張%'       匹配模式
 
select * from 教學表 where 姓名 like '張%'
 
select * from 成績表 where 課程成績 is null
 
select * from 成績表 where 課程成績 is not null
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章