. TruO'ng D~i HQc cAn ThO' Dap an d~ thi hQc ky 2 Dam hQc 2005-2006 Khoa Cong Ngh~ Thong Tin & TT Mon thi: CO' sit dfi' li~u (CD033) - LAn 02 L(rp: CD Tin hQc K30. ThOi gian lam bai: 90 photo NQIDUNG £.A!!l (1.5 di~m): cho t~p ph\l thuQc ham sau: F = { AB7 C, B7 DE, CD7 EK, CE7GH, G7 AC } a. (0.75d) Su d\lng cac tinh chAt cua ph\l thuQc ham de ch(mg minh: AB 7 G. Tac6: AB 7 C B 7 DE => B 7 E => AB 7 E => AB 7 CE (I) CE7GH :::> CE 7 G (2) Tir (1) & (2) => AB7G (dpcm) b. (0.75d) Kiem tra ph\l thuQc ham sau: BG7 H c6 thuQc F+ hay khong? Ta c6: BG7 H E F+ <;:> HE (BG)+ M~t khac: (BG)+ = BGDEACKH => H E (BG)+ V~y BG7 H E F+. ~.l (1.0 di~m): tim t~p ph\l thuQc ham t6i thi~u cua t~p ph\l thuQc ham: F= {A7 BCD, DE7 EFG, D7 EG} Bwc 1 (0.25d): tach cac thuQc tinh it v~ phii cua cac pth d~ v~ phii chi con mQt thu9c tinh H= {A7 B,A7 C,A7 D,DE7 E,DE7 F,DE7 G,D7 E,D7 G} Bwc 2 (0.5d): Lo~i bo cac thuQc tinh thira -XetA7 B:J= {A7 C,A7 D,DE7 E,DE7 F,DE7 G,D7 E,D7 G} Ta c6: (A)+J = ACDEGF khong chuaH nen gitI A7 B. -XetA7 C:J= {A7 B,A7 0, DE7 E,DE7 F,DE7 G,D7 E,D7 G} Ta c6: (A)+J = ABDEGF khong chua C nen gitI A7 C. -XetA7 D: J= {A7 B, A7 C,DE7 E, DE7 F,DE7 G, D7 E, D7 G} Ta c6: (A)+J = ABC khong chua 0 nen gitI A 7 0 -XetDE7 E:J= {A7 B,A7 C,A7 D,DE7 F,DE7 G,D7 E,D7 G} Ta c6: (DE)+J = DEFG chua E nen lo~i bo DE7 E trong H. -XetDE7 F: J= {A7 B, A7 C, A~ 0, DE~ G, 07 E, D~ G} Ta c6: (DE)+J = DEG khong chua F nen gitI DE~ F. - Xet DE7 G: J = {A7 B, A~ C, A~ D, DE7 F, D7 E, D7 G} Ta c6: (DE)+J = DEFG chua G nen lo~i bo DE7 G trong H. -XetD7 E: J= {A7 B,A7 C, A7 0, DE7 F, 07 G} Ta c6: (D)+J = DG khong chua E nen gitI D~ E. -XetD7 G: J= {A7 B, A7 C, A~ D, DE7 F, 07 E} Ta c6: (D)+J = DE khong chua G nen gitI 07 G. V~yH= {A7 B,A7 C,A7 D,DE7 F, D~ E,D7 G} Bwc 3(0.25d): Lo~i bo cac thuQc tinh thira it v~ trai Ta chi xet cac pth ma v~ trai c6 nhi~u bon 1 thuQc tinh. Do d6, v&i H ta chi xet pth sau: DE~ F - Thu lo~i b6 0: J = { A ~ B, A 7 C, A 7 0, E7 F, D~ E, D~ G} Ta tinh (E)+J = EF Ta tinh (E)+H = E => (E)+J * (E)+H nen gitI D l~i 1 - ':"'" . - Thir 1o~i b6 E: J= {A~ B,A~ C,A~ D,D~ F, D~ E,D~ G} Ta tinh (D)+J = DFEG Ta tinh (D)+H = DEGF =:) (D)+J = (D)+H Den 1o~i b6 E V~y t~p pth t5i thi~u 1a: H = {A~ B, A~ C, A~ D, D~ F, D~ E, D~ G} ~~ (1.5 di~m): cho quaD h~ R(A, B, C, D, E, F, G) v6'i A 1a kh6a cua R. T~p ph\! thuQc ham tren R 1a F= {A~ BC, A~ DE, E~ FG}. Yeti cau: - (O.5d) Viet cac ph\! thuQc ham truy6n E~F,E~G - (I.Od)Tach R thanh cac quaD h~ m6'i th6a d~ng chuAn 3. Cho biet kh6a cua timg quaD h~ tach duqc. RI(A, B, C, D, E) v6'i kh6a chinh cua quaD h~ RI 1a A R2(E, F, G) vm kh6a chinh cua quaD h~ R2 1a E A A CAU 4 (6.0 diem): -~ Viet bi~u thuc d~i s5 quaD h~ cho biet s5 hoa dan, hQ ten, dia chi va s5 di~n tho~i cua nhiing khach hang c6 h6a dan xufit trong thcing 06 Dam 2006. (I.Od) E = (MONTH(NG_XHD)=6 AND YEAR(NG_XHD)=2006) KHACHHANG*HOADON(E) [SOHD,HOTEN, DCHI, SODT] b. Hay viet bi~u thuc d~i s5 quaD h~ va ve cay bi~u thuc t5i Uti tuang (rug v6'i cau a. (O.75d) E = (MONTH(NG_XHD)=6 AND YEAR(NG_XHD)=2006) (KHACHHANG[MAKH, HOTEN, DCHI, SODT] * HOADON(E) [SOHD,MAKH))[SOHD, HOTEN, DCHI, SODT] (O.75d) [SOHD,HOTEN, DCHI, SODT] (E) [SOHD , DCHI, SODT] (=~~~ KHACHHANG 2 ~~- ';;' . . / c. Vi~t cau l~nh SQL: - Cho bi~t hQ ten va s5 di~n tho~i cua cac khach hang co dja chi 6' duCmg 'TrAn Hung D~o'. (0.75d) SELECT HOTEN, SODT FROM KHACHHANG WHERE DCHI LIKE '%Tran Hung Dao%' - Cho bi~t s5 m~t hang hi~n co trong h~ th5ng mua ban hang. (.I.Od) SELECT COUNT(*) AS SO_MHANG FROM HANGHOA - Cho bi~t hQ ten, dja chi, s5 di~n tho~i cua nhti"ng khach hang da d~t mua hang hoa trong nam 2005. (0.75d) SELECT HOTEN, DCHI, SODT FROM KHACHHANG KH, PffiEU- DA THANG PDH WHERE KH.MAKH=PDH.MAKH AND YEAR(NGA YDH)=2005 - Cho bi~t s5 hoa don va t6ng trj gia hoa don da xuAt cho khach hang 'Nguy~n Quynh'. (.I.Od) SELECT SORB, SUM(SOLG*DONGIA_BAN) AS TG_TGB FROM HOADON HD, CHITIET_HD CTHD, KHACHHANG KH WHERE CTHD.SOHD=HD.SOHD AND HD.MAHH=KH.MAHH AND HOTEN='Nguyen Quynh' GROUP BY SOHD H~t CAn thO', ngay .12 thang 08 nam 2006 GV ra d~ -~~~:::====~=- Phan Tin Tai 3 . . TruO'ng D~i HQc cAn ThO' Dap an d~ thi hQc ky 2 Dam hQc 20 05 -20 06 Khoa Cong Ngh~ Thong Tin & TT Mon thi: CO' sit dfi' li~u (CD033) - LAn 02 L(rp: CD Tin hQc K30. ThOi gian lam. G. Tac6: AB 7 C B 7 DE => B 7 E => AB 7 E => AB 7 CE (I) CE7GH :::> CE 7 G (2) Tir (1) & (2) => AB7G (dpcm) b. (0.75d) Kiem tra phl thuQc ham sau: BG7 H c6 thuQc F+ hay khong? Ta. (BG)+ V~y BG7 H E F+. ~.l (1.0 di~m): tim t~p phl thuQc ham t6i thi~ u cua t~p phl thuQc ham: F= {A7 BCD, DE7 EFG, D7 EG} Bwc 1 (0 .25 d): tach cac thuQc tinh it v~ phii cua cac pth d~ v~ phii chi