<%@LANGUAGE="VBSCRIPT" CODEPAGE="950"%> 拓米數位MySQL教學文件
文件標題:[E004]select指令與where敘述使用數學運算元

內容說明:

1、select指令加上where敘述
2、where敘述使用數學運算元

教學內容:

1、select指令加上where敘述

where敘述用於條件式的篩選資料

指令:select 欄位名稱 from 資料表名稱 where 條件式;

2、where敘述使用數學運算元

數學運算元:+、-、*、/、( )、=、>、<、<>、>=、<=

範例一:列出所有欄位,符合國文科目小於60分的資料

指令:select * from exam where cht<60;

範例二:列出編號和姓名欄位,符合國文科目小於60分的資料

指令:select no,name from exam where cht<60;

範例三:列出姓名欄位和平均別名,符合三科目平均60分以上的資料

指令:

select name,(cht+eng+math)/3 as average from exam where (cht+eng+math)/3>60;

   
   最後修改日期: 2003年10月20日