成績管理系統的資料操作實驗

2021-08-14 15:54:36 字數 1231 閱讀 1252

在挑戰實驗1中構建的成績管理系統中,物理老師想要找出分數最高的同學進行表揚,請你找出這個同學並把他的資訊(id、姓名、性別)輸出到路徑 /tmp/ 下的 physics.txt檔案中。同時 tom 的化學成績有異議,需要在原來的基礎上加3分,請更新 tom 的化學成績。

1.mysql 服務處於執行狀態

3.找出物理(physics)分數最高的同學,並把他的資訊(id、姓名、性別)輸出到路徑 /tmp/ 下的 physics.txt檔案中

4.修改 tom 的化學(chemistry)成績,在原來的基礎上加3分

學生表(student):學生 id 、學生姓名和性別

課程表(course):課程 id 和課程名

成績表(mark):成績 id 、學生 id 、課程 id 和分數

伺服器中的 mysql 還沒有啟動,請注意 mysql 的 root 賬戶預設密碼為空。

wget 

.aliyuncs

.com/courses/9/createdb.sql

mysql 服務處於執行狀態

sudo service mysql start

mysql -u root

source /home/shiyanlou/createdb.sql;
找出物理(physics)分數最高的同學,並把他的資訊(id、姓名、性別)輸出到路徑 /tmp/ 下的 physics.txt檔案中

select st.sid ,st.sname,st.gender into outfile '/tmp/physics.txt'

from student as st join mark as ma on ma.sid = st.sid join course as co on co.cid = ma.cid where co.cname = 'physics'

order

by ma.score limit 1;

修改 tom 的化學(chemistry)成績,在原來的基礎上加3分

update mark set score = score +3

where sid=(select sid from student where sname="tom") and cid = (select cid from course where cname="chemistry")

成績管理系統

file name slist.c 單向鍵結鍊錶,插入 刪除使用排序 學會對檔案操作檔案操作和單鏈表一起使用 include include include include void read func void void write func void void insert func void ...

成績管理系統

為什麼我的這個成績管理系統 只要有兩個人的成績以後 再次使用add函式就不能新增了學生了 include include includestruct student head null int n 0 int couting struct student head struct student cr...

MySQL 挑戰2 成績管理系統的資料操作

在挑戰實驗1中構建的成績管理系統中,物理老師想要找出分數最高的同學進行表揚,請你找出這個同學並把他的資訊 id 姓名 性別 輸出到路徑 var lib mysql files 下的 physics.txt檔案中。同時 tom 的化學成績有異議,需要在原來的基礎上加3分,請更新 tom 的化學成績。w...