溫瑞烘老師的教學歷程檔案(Teaching ePortfolio) - 102-2-四技資管二甲乙資料庫管理系統 - 第十一週UPDATE
 

資訊管理系
副教授
温瑞烘


歷程檔案 Portfolio


關於我 About Me

第十一週UPDATE

UPDATE 更新欄位資料,常要搭配 WHERE

1. UPDATE stmd SET student_no="10014D001";
  會將所有學號都改成 10014D001
2. UPDATE stmd SET student_name="張三豐" WHERE student_no="10014D001";
  會將學號 10014D001 的姓名欄更改
3. UPDATE stmd set depart_class="164D31",student_name="李四"
     WHERE student_no="10114D001";

另外 SQL中可加入運算

select depart_class,student_no,student_name,score1,score2,score3,
(score1+score2+score3) as total_score, (score1+score2+score3)/3 as average_score
from stmd group by student_no order by depart_class,student_no

建立資料表 包括
depart_class
student_no
student_name
address
score1
score2
score3
total_score
average_score 
以INSERT INTO stmd(depart_class,student_no,student_name,address,score1,score2,score3)
VALUES("164D11","1014D001","張三","台北市南港區研究院路3段245號",60,70,80);
輸入四班12筆資料

作業

1. 更新每位學生的總分(total_score)
2. 更新每位學生的平均(average_score)
3. 更新每位學生的score1 加10 分
4. 更新每位學生的score2 減10 分
5. 查詢所有學生成績, 顯示score1 score2 score3 total_score 與average_score
6. 查詢所有學生成績, 顯示score1 score2 score3 total_score 與average_score,
   按總分由小至大排序
7. 查詢所有學生成績, 顯示score1 score2 score3 total_score 與average_score,
   按總分由大至小排序
8. 更新學生班級 164D11 改 164E11
9. 所有學生升上一年,即更改depart_class的第五碼
10.所有甲班學生改成乙班,即更改depart_class的第六碼
11.所有學生降級一年
12.所有台北市學生各科成績加20%


 

全部共 0則留言
登入帳號密碼代表遵守學術網路規範
 


文章分類 Labels

 


最新文章 Top10

中華科技大學數位化學習歷程 - 意見反應