Mô tả các mối quan hệ trong AM

Một phần của tài liệu NGHIÊN CỨU ỨNG DỤNG ANCHOR MODELING VÀ KHUNG NHÌN THỰC ĐỂ NÂNG CAO HIỆU QUẢ QUẢN LÝ ĐIỂM HỌC SINH TẠI TRƯỜNG THPT BA GIA TỈNH QUẢNG NGÃI (Trang 47 - 57)

6. Bố cục luận văn

2.4.2. Mô tả các mối quan hệ trong AM

Dựa vào mô hình thực thể kết hợp, mô hình dữ liệu quan hệ và các định nghĩa về mối quan hệ trong AM, ta mô tả các mối quan hệ theo AM như sau:

Bảng 2.9. Mô tả các mối quan hệ theo AM

TT Tên hai tập thực thể Loại mối quan hệ theo AM

1 HOCSINH - LOP Static Tie

2 HOCSINH - PHUHUYNH Knotted Historized Tie 3 HOCSINH - HANHKIEM Knotted Static Tie 4 HOCSINH - BANGDIEM Historized Tie

5 GIAOVIEN - MONHOC Knotted Historized Tie 6 MONHOC - BANGDIEM Static Tie

7 BANGDIEM - HOCKY Static Tie

8 HOCKY - NAMHOC Static Tie

9 HOCKY - HANHKIEM Knotted Static Tie 10 BANGDIEM – DIEM_HS1 Historized Tie 11 BANGDIEM – DIEM_HS1 Historized Tie 12 BANGDIEM – DIEM_HS1 Historized Tie

Từ truy vấn tính điểm trung bình từng môn trong bảng 2.4, ta viết lại truy vấn này trên CSDL có ứng dụng AM như sau:

Bảng 2.10. Truy vấn tính điểm trung bình từng môn có ứng dụng AM

Dữ liệu vào: dbo.lbdiem_bangdiem, dbo.ldhs1_diem_hs1, dbo.ldhs2_diem_hs2, dbo.ldhs2_diem_hs3

Dữ liệu ra: Bảng điểm trung bình từng môn học của học sinh theo học kỳ Xử lý: select

tong12.bdiem_mm_bangdiem_ma_mon,tong12.bdiem_mhs_bang diem_ma_hs,

tong12.bdiem_mhk_bangdiem_ma_hky,

(max(tong12.tong12)+max(tong3)*3)/(max(tong12.dem12)+3) as tbmon

from

(select

tong2.bdiem_mm_bangdiem_ma_mon,tong2.bdiem_mhs_bangdie m_ma_hs,

tong2.bdiem_mhk_bangdiem_ma_hky,

(max(tong1.tong1)+max(tong2.tong2)*2) as tong12, (max(tong1.dem1)+max(tong2.dem2)*2) as dem12 from

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, sum(dbo.ldhs1_diem_hs1.dhs1_diem1_diem_hs1_diem_l1)

as tong1,

count(dbo.ldhs1_diem_hs1.dhs1_diem1_diem_hs1_diem_l

1) as dem1

from dbo.lbdiem_bangdiem join dbo.ldhs1_diem_hs1 on dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs1_diem_hs1.dhs1_mm_diem_hs1_ma_mon

and

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs=dbo.ldhs1_ diem_hs1.dhs1_mhs_diem_hs1_ma_hs

and

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs1 _diem_hs1.dhs1_mhk_diem_hs1_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky) AS tong1

join

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, sum(dbo.ldhs2_diem_hs2.dhs2_diem2_diem_hs2_diem_l2)

as tong2,

count(dbo.ldhs2_diem_hs2.dhs2_diem2_diem_hs2_diem_l

2) as dem2

from dbo.lbdiem_bangdiem join dbo.ldhs2_diem_hs2 on dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs2_diem_hs2.dhs2_mm_diem_hs2_ma_mon

and

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs=dbo.ldhs2_ diem_hs2.dhs2_mhs_diem_hs2_ma_hs

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs2 _diem_hs2.dhs2_mhk_diem_hs2_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky) AS tong2

on

tong1.bdiem_mm_bangdiem_ma_mon=tong2.bdiem_mm_

bangdiem_ma_mon and

tong1.bdiem_mhs_bangdiem_ma_hs=tong2.bdiem_mhs_ba

ngdiem_ma_hs and

tong1.bdiem_mhk_bangdiem_ma_hky=tong2.bdiem_mhk_ bangdiem_ma_hky

group by

tong2.bdiem_mm_bangdiem_ma_mon,tong2.bdiem_mhs_bangdie m_ma_hs,

tong2.bdiem_mhk_bangdiem_ma_hky ) as tong12

join

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, max(dbo.ldhs3_diem_hs3.dhs3_diem3_diem_hs3_diem_l3)

as tong3

from dbo.lbdiem_bangdiem join dbo.ldhs3_diem_hs3 on dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs3_diem_hs3.dhs3_mm_diem_hs3_ma_mon

and

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs=dbo.ldhs3_ diem_hs3.dhs3_mhs_diem_hs3_ma_hs

and

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs3 _diem_hs3.dhs3_mhk_diem_hs3_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

tong3 on

tong12.bdiem_mm_bangdiem_ma_mon=tong3.bdiem_mm_bangd iem_ma_mon

and

tong12.bdiem_mhs_bangdiem_ma_hs=tong3.bdiem_mhs_bangdie m_ma_hs

and

tong12.bdiem_mhk_bangdiem_ma_hky=tong3.bdiem_mhk_bangd iem_ma_hky

group by

tong12.bdiem_mm_bangdiem_ma_mon,tong12.bdiem_mhs_bang diem_ma_hs,

tong12.bdiem_mhk_bangdiem_ma_hky

Từ truy vấn tính điểm trung bình tất cả các môn trong bảng 2.5, ta viết lại truy vấn này trên CSDL có ứng dụng AM như sau:

Bảng 2.11. Truy vấn tính điểm trung bình tất cả các môn học có ứng dụng AM

Dữ liệu vào: dbo.lbhs_hocsinh, dbo.lbdiem_bangdiem, dbo.ldhs1_diem_hs1, dbo.ldhs2_diem_hs2, dbo.ldhs2_diem_hs3

Dữ liệu ra: Bảng điểm trung bình các môn học của học sinh theo học kỳ Xử lý: select

dbo.lbhs_hocsinh.ma_hs,dbo.lbhs_hocsinh.hodem_hs,dbo.lbhs_ho csinh.ten_hs,

AVG(tamtbm.tbmon) as TBcacmonhky from

(select

tong12.bdiem_mm_bangdiem_ma_mon,tong12.bdiem_mhs_bang diem_ma_hs,

tong12.bdiem_mhk_bangdiem_ma_hky,

(max(tong12.tong12)+max(tong3))/(max(tong12.dem12)+1

) as tbmon from

(select

tong2.bdiem_mm_bangdiem_ma_mon,tong2.bdiem_mhs_bangdie m_ma_hs,

tong2.bdiem_mhk_bangdiem_ma_hky,

(max(tong1.dem1)+max(tong2.dem2)*2) as dem12 from

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, sum(dbo.ldhs1_diem_hs1.dhs1_diem1_diem_hs1_diem_l1)

as tong1,

count(dbo.ldhs1_diem_hs1.dhs1_diem1_diem_hs1_diem_l

1) as dem1

from dbo.lbdiem_bangdiem join dbo.ldhs1_diem_hs1 on dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs1_diem_hs1.dhs1_mm_diem_hs1_ma_mon

and

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs=dbo.ldhs1_ diem_hs1.dhs1_mhs_diem_hs1_ma_hs

and

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs1 _diem_hs1.dhs1_mhk_diem_hs1_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky) AS tong1

join

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, sum(dbo.ldhs2_diem_hs2.dhs2_diem2_diem_hs2_diem_l2)

as tong2,

count(dbo.ldhs2_diem_hs2.dhs2_diem2_diem_hs2_diem_l

2) as dem2

from dbo.lbdiem_bangdiem join dbo.ldhs2_diem_hs2 on dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs2_diem_hs2.dhs2_mm_diem_hs2_ma_mon

and

diem_hs2.dhs2_mhs_diem_hs2_ma_hs

and

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs2 _diem_hs2.dhs2_mhk_diem_hs2_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky) AS tong2

on

tong1.bdiem_mm_bangdiem_ma_mon=tong2.bdiem_mm_ bangdiem_ma_mon

and

tong1.bdiem_mhs_bangdiem_ma_hs=tong2.bdiem_mhs_ba ngdiem_ma_hs

and

tong1.bdiem_mhk_bangdiem_ma_hky=tong2.bdiem_mhk_ bangdiem_ma_hky

group by

tong2.bdiem_mm_bangdiem_ma_mon,tong2.bdiem_mhs_bangdie m_ma_hs,

tong2.bdiem_mhk_bangdiem_ma_hky ) as tong12

join

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, max(dbo.ldhs3_diem_hs3.dhs3_diem3_diem_hs3_diem_l3)

as tong3

from dbo.lbdiem_bangdiem join dbo.ldhs3_diem_hs3 on dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs3_diem_hs3.dhs3_mm_diem_hs3_ma_mon

and

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs=dbo.ldhs3_ diem_hs3.dhs3_mhs_diem_hs3_ma_hs

and

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs3 _diem_hs3.dhs3_mhk_diem_hs3_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky) as tong3

on

tong12.bdiem_mm_bangdiem_ma_mon=tong3.bdiem_mm _bangdiem_ma_mon

and

tong12.bdiem_mhs_bangdiem_ma_hs=tong3.bdiem_mhs_b angdiem_ma_hs

and

tong12.bdiem_mhk_bangdiem_ma_hky=tong3.bdiem_mhk _bangdiem_ma_hky

group by

tong12.bdiem_mm_bangdiem_ma_mon,tong12.bdiem_mhs _bangdiem_ma_hs,

tong12.bdiem_mhk_bangdiem_ma_hky) as tamtbm,

dbo.lbhs_hocsinh where

tamtbm.bdiem_mhs_bangdiem_ma_hs=dbo.lbhs_hocsinh.

ma_hs

group by

dbo.lbhs_hocsinh.ma_hs,dbo.lbhs_hocsinh.hodem_hs,dbo.lbhs_ho csinh.ten_hs

order by dbo.lbhs_hocsinh.ten_hs

Từ truy vấn xếp loại học lực học sinh trong bảng 2.6, ta viết lại truy vấn này trên CSDL có ứng dụng AM như sau:

Bảng 2.12. Truy vấn xếp loại học lực học sinh có ứng dụng AM

Dữ liệu vào: dbo.lbhs_hocsinh, dbo.lbdiem_bangdiem, dbo.ldhs1_diem_hs1, dbo.ldhs2_diem_hs2, dbo.ldhs2_diem_hs3

Dữ liệu ra: Xếp lọi học sinh cuối học kỳ

Xử lý: select tam1.ma_hs,tam1.hodem_hs,

tam1.ten_hs,tam1.tbcacmonhky,

case

when ((tam1.tbcacmonhky>=8) and (tam1.minmon)>=6.5) then

when ((tam1.tbcacmonhky>=6.5) and (tam1.minmon)>=5) then

'Kha'

when ((tam1.tbcacmonhky>=5) and (tam1.minmon)>=3.5) then

'TBinh'

when ((tam1.tbcacmonhky>=3.5) and (tam1.minmon)>=2) then

'Yeu'

else 'Kem'

end as xeploai from

(select

dbo.lbhs_hocsinh.ma_hs,dbo.lbhs_hocsinh.hodem_hs,dbo.lbhs_ho csinh.ten_hs,

AVG(tamtbm.tbmon) as tbcacmonhky, min(tamtbm.tbmon) as minmon

from

(select

tong12.bdiem_mm_bangdiem_ma_mon,tong12.bdiem_mhs_bang diem_ma_hs,

tong12.bdiem_mhk_bangdiem_ma_hky,

(max(tong12.tong12)+max(tong3))/(max(tong12.dem12)+1) as tbmon

from

(select

tong2.bdiem_mm_bangdiem_ma_mon,tong2.bdiem_mhs_bangdie m_ma_hs,

tong2.bdiem_mhk_bangdiem_ma_hky,

(max(tong1.tong1)+max(tong2.tong2)*2) as tong12, (max(tong1.dem1)+max(tong2.dem2)*2) as dem12 from

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, sum(dbo.ldhs1_diem_hs1.dhs1_diem1_diem_hs1_diem_l1)

as tong1,

count(dbo.ldhs1_diem_hs1.dhs1_diem1_diem_hs1_diem_l

1) as dem1

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs1_diem_hs1.dhs1_mm_diem_hs1_ma_mon

and

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs=dbo.ldhs1_ diem_hs1.dhs1_mhs_diem_hs1_ma_hs

and

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs1 _diem_hs1.dhs1_mhk_diem_hs1_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky) AS tong1

join

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, sum(dbo.ldhs2_diem_hs2.dhs2_diem2_diem_hs2_diem_l2)

as tong2,

count(dbo.ldhs2_diem_hs2.dhs2_diem2_diem_hs2_diem_l

2) as dem2

from dbo.lbdiem_bangdiem join dbo.ldhs2_diem_hs2 on dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs2_diem_hs2.dhs2_mm_diem_hs2_ma_mon

and

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs=dbo.ldhs2_ diem_hs2.dhs2_mhs_diem_hs2_ma_hs

and

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs2 _diem_hs2.dhs2_mhk_diem_hs2_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky) AS tong2

on

bangdiem_ma_mon

and

tong1.bdiem_mhs_bangdiem_ma_hs=tong2.bdiem_mhs_ba ngdiem_ma_hs

and

tong1.bdiem_mhk_bangdiem_ma_hky=tong2.bdiem_mhk_ bangdiem_ma_hky

group by

tong2.bdiem_mm_bangdiem_ma_mon,tong2.bdiem_mhs_bangdie m_ma_hs,

tong2.bdiem_mhk_bangdiem_ma_hky ) as tong12

join

(select

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky, max(dbo.ldhs3_diem_hs3.dhs3_diem3_diem_hs3_diem_l3)

as tong3

from dbo.lbdiem_bangdiem join dbo.ldhs3_diem_hs3 on dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon=db o.ldhs3_diem_hs3.dhs3_mm_diem_hs3_ma_mon

and

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs=dbo.ldhs3_ diem_hs3.dhs3_mhs_diem_hs3_ma_hs

and

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky=dbo.ldhs3 _diem_hs3.dhs3_mhk_diem_hs3_ma_hky

group by

dbo.lbdiem_bangdiem.bdiem_mm_bangdiem_ma_mon,

dbo.lbdiem_bangdiem.bdiem_mhs_bangdiem_ma_hs,

dbo.lbdiem_bangdiem.bdiem_mhk_bangdiem_ma_hky) as tong3

on

tong12.bdiem_mm_bangdiem_ma_mon=tong3.bdiem_mm _bangdiem_ma_mon

and

tong12.bdiem_mhs_bangdiem_ma_hs=tong3.bdiem_mhs_b angdiem_ma_hs

and

tong12.bdiem_mhk_bangdiem_ma_hky=tong3.bdiem_mhk _bangdiem_ma_hky

group by

tong12.bdiem_mm_bangdiem_ma_mon,tong12.bdiem_mhs _bangdiem_ma_hs,

tong12.bdiem_mhk_bangdiem_ma_hky) as tamtbm,

dbo.lbhs_hocsinh where

tamtbm.bdiem_mhs_bangdiem_ma_hs=dbo.lbhs_hocsinh.

ma_hs

group by

dbo.lbhs_hocsinh.ma_hs,dbo.lbhs_hocsinh.hodem_hs,dbo.lbhs_ho csinh.ten_hs) as tam1

Một phần của tài liệu NGHIÊN CỨU ỨNG DỤNG ANCHOR MODELING VÀ KHUNG NHÌN THỰC ĐỂ NÂNG CAO HIỆU QUẢ QUẢN LÝ ĐIỂM HỌC SINH TẠI TRƯỜNG THPT BA GIA TỈNH QUẢNG NGÃI (Trang 47 - 57)

Tải bản đầy đủ (PDF)

(100 trang)