Trường CĐSP Thái Nguyên

  • View
    56

  • Download
    0

Embed Size (px)

DESCRIPTION

Trng CSP Thi Nguyn. Mn: C S D LIU V H CSDL. Ni dung. Bi 1: Cc khi nim ca mt h CSDL Bi 2: Cc m hnh CSDL Bi 3: M hnh d liu quan h (ca Codd) Bi 4: Ngn ng i s quan h Bi 5: Ngn ng SQL Bi 6: Ngn ng tn t Bi 7: Rng buc ton vn trong mt CSDL - PowerPoint PPT Presentation

Transcript

  • Trng CSP Thi NguynMn: C S D LIU V H CSDL

  • Ni dungBi 1: Cc khi nim ca mt h CSDLBi 2: Cc m hnh CSDLBi 3: M hnh d liu quan h (ca Codd)Bi 4: Ngn ng i s quan hBi 5: Ngn ng SQLBi 6: Ngn ng tn tBi 7: Rng buc ton vn trong mt CSDLBi 8: Ti u ha cu hi bng i s quan h

  • Bi 1: Cc khi nim ca mt h CSDL

  • Bi 1: Cc khi nim ca mt h CSDLGii thiuH thng tp tin (File System)nh ngha mt CSDLCc i tng s dng CSDLH qun tr CSDLCc mc ca mt CSDL

  • 1. Gii thiuTi sao cn phi c mt c s d liu?

  • 2. H thng tp tinL tp hp cc tp tin ring l phc v cho mt mc ch ca n v s dng.u im: Trin khai ng dng nhanhKh nng p ng nhanh chng, kp thi (v ch phc v cho mc ch hn hp)Khuyt im:Trng lp d liu lng ph, d liu khng nht qunChi ph caoChia s d liu km

  • 3. C s d liu (1)nh ngha: C s d liu l mt h thng cc thng tin c cu trc, c lu tr trn cc thit b lu tr nhm tha mn yu cu khai thc thng tin ng thi ca nhiu ngi s dng hay nhiu chng trnh ng dng vi nhng mc ch khc nhau

  • 3. C s d liu (2)u im:Gim trng lp thng tin xung mc thp nht, m bo tnh nht qun v ton vn d liu.m bo d liu c truy xut theo nhiu cch khc nhau.Kh nng chia s thng tin cho nhiu ngi, nhiu ng dng khc nhau.

  • 3. C s d liuNhng vn cn gii quyt:Tnh ch quyn d liu.Tnh bo mt v quyn khai thc thng tin ca ngi s dngTranh chp d lium bo d liu khi c s c

  • 4. Cc i tng s dngNgi s dng CSDL khng chuyn v lnh vc tin hc v CSDL => cn cng c h c th khai thc CSDL khi cn.Chuyn vin tin hc xy dng cc ng dng phc v cho cc mc ch qun l Qun tr CSDL: t chc CSDL, bo mt, cp quyn, sao lu, phc hi d liu, gii quyt cc tranh chp d liu

  • 5. H qun tr c s d liu (1)H qun tr c s d liu (DBMS DataBase Management System) l h thng cc phn mm h tr tch cc cho cc nh phn tch, thit k v khai thc CSDL.Cc DBMS thng dng: Visual FoxPro, Microsoft Access, SQL Server, DB2, Oracle hu ht cc DBMS hin nay u da trn m hnh quan h.

  • 5. H qun tr c s d liu (2)Mt DBMS phi c:Ngn ng giao tip gia ngi s dng v CSDLT in d liu (Data Dictionary)C bin php bo mt khi c yu cuC ch gii quyt tranh chp d liuC c ch sao lu (backup), phc hi (restore)m bo tnh c lp gia d liu v chng trnh

  • 5. H qun tr c s d liu (3)Ngn ng giao tip:Ngn ng m t d liu (DDL Data Definition Language): cho php khai bo cu trc CSDL, cc mi lin h ca d liu, cc quy nh, rng buc d liu.Ngn ng thao tc d liu (DML Data Manipulation Language): cho php thc hin thao tc thm, xa, sa d liu.Ngn ng truy vn c cu trc (SQL Structured Query Language): cho php ngi khai thc s dng truy vn thng tin cn thit.Ngn ng qun l d liu (DCL Data Control Language) cho php thay i cu trc bng, khai bo bo mt, cp quyn cho ngi s dng.

  • 6. Cc mc biu din mt CSDLMc trong: (mc vt l Physical) l mc lu tr CSDL (cn gii quyt vn g? D liu g? Lu tr nh th no? u? Cn cc ch mc g? Truy xut tun t hay ngu nhin. Dnh cho ngi qun tr v ngi s dng chuyn mn.Mc quan nim: (Conception hay Logical) cn phi lu tr bao nhiu loi d liu? l d liu g? mi quan hMc ngoi: ca ngi s dng v cc chng trnh ng dng

  • 6. Cc mc biu din mt CSDLCu trc ngoi 1Cu trc ngoi 2Cu trc ngoi nChng trnh ng dng nMcquannimhocmclogicMc vt l Cu trc vt lCSDLMi trngthc th giithcNSD1NSD2

  • Bi 2: Cc m hnh d liu

  • Ni dungGii thiuM hnh d liu mngM hnh thc th mi kt hp

  • 1. Gii thiu M hnh d liu l s tru tng ha ca mi trng thc, biu din d liu mc quan nim. Gii thiu mt s m hnh nh:M hnh d liu mngM hnh d liu phn cpM hnh d liu thc th mi kt hpM hnh d liu quan hM hnh d liu hng i tng

  • 2. M hnh d liu mng (1)M hnh d liu mng (Network Data Model) cn gi tt l m hnh mng hoc m hnh li l m hnh c biu din bi mt th c hng.Mu tin (record)Loi mu tin Loi lin h (set type)Bn s

  • 2. M hnh d liu mng (2)Mu tin: m t 1 i tng trong th gii thc. (NV001,Nguyen Lam,Nam,10/10/1970,Dong Nai)Loi mu tin: l 1 tp cc mu tin c cng tnh cht. V d: NHANVIENK hiu: Loi lin h: m t s lin kt gia 1 loi mu tin ch v 1 loi mu tin thnh vinK hiu:

    NHANVIENTham giaCONGVIEC

  • 2. M hnh d liu mng (3)Bn s: ch ra s lng cc mu tin tham gia trong mi lin h:(1:1) (one-to-one): mi mu tin ca loi mu tin ch kt hp vi ng 1 mu tin ca loi mu tin thnh vin.(1:n) (one-to-many): mi mu tin ca loi mu tin ch kt hp vi 1 hay nhiu mu tin thnh vin.(n:1) (many-to-one): nhiu mu tin ca loi mu tin ch kt hp vi ng 1 mu tin ca loi mu tin thnh vin.(Recursive): mt loi mu tin ch cng c th ng thi l loi mu tin thnh vin vi chnh n. Loi lin h ny l quy

  • 2. M hnh d liu mng (4)PHONGCONGVIECNHANVIENLYLICHgmcqun ltrc tipcng lmn:11:11:n1:n

  • 2. M hnh d liu mng (5)M hnh d liu mng:Tng i n ginD s dngKhng thch hp biu din CSDL c quy m lnKh nng din t ng ngha km

  • 2. M hnh d liu mng (6)Bi tp: Xy dng m hnh d liu mng cho c s d liu qun l bn hng trong mt siu th (gio vin m t hin trng, xc nh cc yu cu)