Fundamental and Application of Database ? o?¨$ ? o?¨$ ? t? ? t? ? e/ ?D1???ù?? ? e/ ?D1???ù?? ? ¥t ? ¥t 3.10 b′¥) ? b′¥) ? z b′¥á 3 b′¥á 3 z b′¥ ? b′¥ ? z V? | b′¥K? V? | b′¥K? zμ b′¥ ? μ b′¥ ? 3.11 3 ? ? T T SQL zSQL?y4  ??]¥ P¨Z T ?y4  ??]¥ P¨Z T – ?o T ?o T – 3 ? T 3 ? T z1 I 11? ? 3 ? T 1 I 11? ? 3 ? T SQL – SQL?y ^dV???y ?y ^dV???y – Y) ??¨31ú)?y Y) ??¨31ú)?y z? ?Z T%? μμY?? !9¥ìa ? ?Z T%? μμY?? !9¥ìa / / SQL? 1S tA1¥ ? ? 1S tA1¥ ? 3.11.1 3 ? T 3 ? T SQL¥B?? T ¥B?? T z1  us 1  us SQL? D??y? 31 ? D??y? 31 : z - EXEC SQL z2 ?S? ???y¥?]7?] 2 ?S? ???y¥?]7?] z[ [ C1??y¥ 3 ? T 1??y¥ 3 ? T SQL? ¥B?? T ? ¥B?? T EXEC SQL <SQL?  ?  >; è &9&$42-%3015"#-&4UVEFOU z[ [ COBOLT1??y¥ 3 ? T T1??y¥ 3 ? T SQL? ¥B?? T ? ¥B?? T EXEC SQL <SQL?  ?  > END-EXEC è EXEC SQL DROP TABLE Student END-EXEC DBMS) ? ó?? ? o?y ) ? ó?? ? o?y SQL ¥ZE ¥ZE z?Ir ?Ir z??? ? ??y P- ?) ? ??? ? ??y P- ?) ? SQL?  ?  ?Ir ?Ir 1  ? ? DBMS¥?) ???÷??é? á í ¥?) ???÷??é? á í MY MY SQL?  ?  2ü ? ì ü ? ì D D ???y?¨? [ P??y ???y?¨? [ P??y Ir?? ? MY ? Ir?? ? MY ? 3Ka???y¥Ir??|??÷?? Ka???y¥Ir??|??÷?? Ir Ir ? "S ?b ? "S ?b 3 ? SQL?  ?  a ü??  a ü??  3 ? SQL?  ?  ? ?l ? ?l V3??  V3??  ? e? ? e? ? ?: ? ?: z ?C V3?¥ú)?y? ¥1Z? V  ?C V3?¥ú)?y? ¥1Z? V [ V3? [ V3? SQL?  ?  z ?C a ü? ¥1Z? V[ a ü?  ?C a ü? ¥1Z? V[ a ü? SQL?  ?  3.11.2 3 ? T 3 ? T SQL? D ? D ??y-W¥Y? ??y-W¥Y? | | SQL 3 ??ú)?y??I?????c 3 ??ú)?y??I?????c μ ??]9 ? ?¥?  μ ??]9 ? ?¥?  – SQL?  ?  z í ??¥ ?_"?¥?  í ??¥ ?_"?¥?  zμ3?: ? o μ3?: ? o –ú)?y?  ú)?y?  zV??¥ ?_: c¥?  V??¥ ?_: c¥?  zμ3 e??? @? μ3 e??? @? yT?í-W¥Y?Z T yT?í-W¥Y?Z T 1. SQLY? u Y? u _??y.?_??y.? SQL? ¥3? ??? ¥3? ?? ??y ? N e??? @???y ? N e??? @? 2. ?M  ?M  1??y_??y_ SQL? 4? ?? 4? ? 2| SQL? °? ? o¥2T???yéB?) ?? °? ? o¥2T???yéB?) ? 3. 3S 3S 3 %"???T?yDV???T?y¥? ? ¥3 %"???T?yDV???T?y¥? ? ¥ 1. SQLY? u Y? u z SQLCA  SQL Communication Area – SQLCA ^B? ? 2 ^B? ? 2 z SQLCA¥¨o ¥¨o – SQL? 3?a ? 3?a DBMSQ ?ó?¨??? Q ?ó?¨??? z í ?"d? -yT ? í ?"d? -yT ? z í ??ìa í ??ìa – ?t?| ?? ?t?| ?? SQLY? u Y? u SQLCA? ? – ?¨??V ?¨??V SQLCA? |?t ?? N %? ? |?t ?? N %? ¤/ ?3?¥?  ¤/ ?3?¥?  SQLCA¥ = ? ¥ = ? z D ?3?¥ D ?3?¥ SQL? μ1 ? μ1 z D? D? SQL? ¥3? f ?μ1 ? ¥3? f ?μ1 è3? ÷"?  è3? ÷"?  DELETEa?]¥3? f ?a?]¥3? f ? SQLCA?? μ?]¥?μ?]¥? z ′Q ?  1?5?T '′Q ?  1?5?T ' z àμ ?@Hq¥?B?9 àμ ÷" àμ ?@Hq¥?B?9 àμ ÷" z ?? ÷"iμ ÷"¥? ??? ÷"iμ ÷"¥? ? z íHq ÷"Tá?íHq ÷"Tá? z ??ò?ey3?p??ò?ey3?p SQLCA¥ P¨ZE ¥ P¨ZE –?l ?l SQLCA z¨ ¨ EXEC SQL INCLUDE SQLCAF[?l F[?l – P¨ P¨ SQLCA zSQLCA?μB?ib ?Q3? ?μB?ib ?Q3? SQL? aRí ? aRí } ?¥M  } ?¥M  SQLCODE z ?T ?T SQLCODE????l¥è  ????l¥è  SUCCESS 5V U SQL? ???5V Up ? ???5V Up z?¨?? ?3??BH ?¨?? ?3??BH SQL ? -a???? ? -a???? kB/ kB/ SQLCODE¥′[ 3? ¥′[ 3? SQL? 3? ? 3? f ?iSM?) ? f ?iSM?) ? 2. ?M  ?M  z I 1 ^?M  I 1 ^?M  – 3 ? T 3 ? T SQL? ? V[ P¨??y¥??M ? ? V[ P¨??y¥??M  ? { ? { ?  ? { ? { ? –  SQL? ? P¨¥??y??M e?1 ? ? P¨¥??y??M e?1 ?M  ?M  Host Variable ?M  ? ?M  ? z?M ¥ ?? ?M ¥ ?? – { ??M  { ??M  z??¨?? ?′ ??¨?? ?′ SQL? ?¨ ? ?¨ – {?M  {?M  z? ? SQL? ?′ !? ??Ríó ? ?′ !? ??Ríó ?¨?? ?¨?? –B??M μ V ?; ^ { ??M ? ^ { B??M μ V ?; ^ { ??M ? ^ { ?M  ?M  ?M  ? ?M  ? z?M ¥¨o ?M ¥¨o – { ??M  { ??M  z·?_ ? o?? ?¥ ? ·?_ ? o?? ?¥ ? z| ? o?¥ ? ??1·?′ | ? o?¥ ? ??1·?′ z·?3?¥?T ·?3?¥?T z·? ·? WHERE0  0  HAVING0 ?¥ 0 ?¥ Hq Hq – {?M  {?M  z |  | SQL? ¥2T ? ? ¥2T ? z |  | SQL? ¥3? ? ? ¥3? ? ?M  ? ?M  ? z· UM  · UM  –B??M  V[?{B?· UM  B??M  V[?{B?· UM   Indicator Variable – I 1 ^· UM  I 1 ^· UM  z??M  ??M  z¨ ? ¨ ? “· U ” ?·?M ¥′Hq ?·?M ¥′Hq –· UM ¥¨o · UM ¥¨o z { ??M  V[ ?¨· UM ? b′ { ??M  V[ ?¨· UM ? b′ z {?M  V[ ?¨· UM _? ^? {?M  V[ ?¨· UM _? ^? b′′ ^?$? b′′ ^?$? ?M  ? ?M  ? z  SQL? ? P¨?M ?· UM ¥ ? ? P¨?M ?· UM ¥ ZE ZE – 1) a ü?M ?· UM  a ü?M ?· UM  BEGIN DECLARE SECTION ......... ......... ( a ü?M ?· UM  a ü?M ?· UM  ) ......... END DECLARE SECTION ?M  ? ?M  ? – 2) P¨?M  P¨?M  z a ü-a¥?M  V[ a ü-a¥?M  V[ SQL? ? ?? ? ? ?? B? ? P¨Vr T¥1ZC B? ? P¨Vr T¥1ZC z1 D ? o`  V a jm a  1 D ? o`  V a jm a  ? uY ? uY SQL? ?¥?M  -1 ? ?¥?M  -1 F μ| :T1S? T1S? ?M  ? ?M  ? – 3) P¨· UM  P¨· UM  z· UM  -9A?F μ|S? · UM  -9A?F μ|S? zA??? ?·?M -a A??? ?·?M -a ?M  ? ?M  ? z  SQL? -? ? -? (??y? ? ??y? ? ) P¨?M P¨?M ?· UM ¥ZE ?· UM ¥ZE – V[°¤?¨?AF μ| V[°¤?¨?AF μ| 3. 3S 3S cursor z1 I 11 P¨3S 1 I 11 P¨3S – SQL?yD??y μ?] ? ) ?Z T ?yD??y μ?] ? ) ?Z T zSQL?y ^ ?_"?¥BH ?y ^ ?_"?¥BH SQL?  ?  e5  V[á 3) ?H: c e5  V[á 3) ?H: c 3S ? 3S ?  z??y ^ ?_: c¥BF?M BQ ??y ^ ?_: c¥BF?M BQ o ?ibBH: c o ?ibBH: c –? P¨?M i? ?? ? ?@ ? P¨?M i? ?? ? ?@ SQL? _? ? _? ¨?? { ? ¥1 p ¨?? { ? ¥1 p – 3 ? T 3 ? T SQL? ? 3S¥à Q¨ ?x?? ? ? 3S¥à Q¨ ?x?? ??]¥) ?Z T ??]¥) ?Z T 3S ? 3S ?  z I 1 ^3S I 1 ^3S –3S ^"d1¨? 7 !¥B? ? ? u 3S ^"d1¨? 7 !¥B? ? ? u ib SQL? ¥3?2T ? ¥3?2T – ??3S u?μB? 3 ??3S u?μB? 3 –¨? V[¨ ¨? V[¨ SQL? ?BV3S? |: ? ?BV3S? |: ci?ó?M ????yéB?) ? ci?ó?M ????yéB?) ? 3 ? T 3 ? T SQL? D??y-W¥Y? ? D??y-W¥Y? (? ? ) zl2 l2 – 3 ? T  3 ? T SQL? SQL? D??y? s ? D??y? s ydè ü ? ydè ü ? zSQL? °¤D ? ou?? ? °¤D ? ou?? z??y?  ??y?  1. e??? @? e??? @? 2.   SQL? ¥3?2TSéB? ? ¥3?2TSéB? Fy) ? Fy) ? 3 ? T 3 ? T SQL? D??y-W¥Y? ? D??y-W¥Y? (? ? ) – SQL? ¨?M V??y?¤ l3?? ? ¨?M V??y?¤ l3?? ??: ? o ??: ? o – SQL? ¥3? ?? ? ¥3? ?? DBMS ?à ?à SQLCA? ? –??y??V ??y??V SQLCA? | ?? N ? | ?? N %?/B??T %?/B??T – ?T ?T SQL? V ? o???1_ ì ? ? V ? o???1_ ì ? 5YV?M .ó??ySéB?) ? 5YV?M .ó??ySéB?) ? – SQL?y???y¥?] ? ) ?Z TYV ?y???y¥?] ? ) ?Z TYV 3S ?x? 3S ?x? 3 ? T 3 ? T SQL? D??y-W¥Y? ? D??y-W¥Y? (? ? ) è{μ 3 ? T è{μ 3 ? T SQL¥Bl ¥Bl C?? ?? ............ EXEC SQL INCLUDE SQLCA; /* (1) ?l ?l SQLY? u Y? u */ EXEC SQL BEGIN DECLARE SECTION; /* (2) a ü?M  a ü?M  */ CHAR title_id(7); CHAR title(81); INT royalty; EXEC SQL END DECLARE SECTION; 3 ? T 3 ? T SQL? D??y-W¥Y? ? D??y-W¥Y? (? ? ) main() { EXEC SQL DECLARE C1 CURSOR FOR SELECT tit_id, tit, roy FROM titles; /* (3) 3S?T ?l3S 3S?T ?l3S */ /* V V titlesV?°? V?°? tit_id, tit, roy */ EXEC SQL OPEN C1; /* (4) 3S?T u 73S 3S?T u 73S */ 3 ? T 3 ? T SQL? D??y-W¥Y? ? D??y-W¥Y? (? ? ) for(;;) { EXEC SQL FETCH C1 INTO :title_id, :title, :royalty; /* (5) 3S?T |? - ? b ??M iwé3S·?3S?T |? - ? b ??M iwé3S·? */ if (sqlca.sqlcode <> SUCCESS) /* (6) ?¨ ?¨ SQLCA?¥ ?? %?? H|?ì?¥ ?? %?? H|?ì */ break; printf("Title ID: %s, Royalty: %d", :title_id, :royalty); printf("Title: %s", :title); /* u?°?2Tu?°?2T */ } EXEC SQL CLOSE C1; /* (7) 3S?T 1>3S3S?T 1>3S */ } 3.1 3 ? ? T T SQL 3.11.1 3 ? T 3 ? T SQL¥B?? T ¥B?? T 3.11.2 3 ? T 3 ? T SQL? D??y-W¥Y? ? D??y-W¥Y? 3.11.3 ?¨3S¥ ?¨3S¥ SQL?  ?  3.11.4 P¨3S¥ P¨3S¥ SQL?  ?  3.11.5 ? ? ? ? SQLeo eo 3.11.3 ?¨3S¥ ?¨3S¥ SQL?  ?  z?¨3S¥ ?¨3S¥ SQL? ¥? ? ? ¥? ? – a ü??  a ü??  – ? ?l?  ? ?l?  – ? e??  ? e??  – °?2T1?: c¥ °?2T1?: c¥ SELECT?  ?  – d d CURRENT? T¥ ? T¥ UPDATE?  ?  – d d CURRENT? T¥ ? T¥ DELETE?  ?  – INSERT?  ?  Ba a ü??  Ba a ü??  z a ü??  ^1 3 ? T a ü??  ^1 3 ? T SQL? a ü ? a ü ?M a SQLCA?7 !?¥ ?7 !?¥ z a ü?M  a ü?M  1. EXEC SQL BEGIN DECLARE SECTION; 2. EXEC SQL END DECLARE SECTION; –? H? A? ¥CM??B? ? ? H? A? ¥CM??B? ? | H? ?W ^?M ¥ a ü | H? ?W ^?M ¥ a ü z a ü a ü SQLCA 3. EXEC SQL INCLUDE SQLCA =a ? ?l?  =a ? ?l?  è è 1 y ?B? y ?B? “D 3 D 3 ”V V Student EXEC SQL CREATE TABLE Student (Sno CHAR(5) NOT NULL UNIQUE, Sname CHAR(20), Ssex CHAR(1), Sage INT, Sdept CHAR(15)); ? ?l?  ? ? ?l?  ? z ? ?l? ?? ? P¨?M  ? ?l? ?? ? P¨?M  è/ ?  ^p¥ è/ ?  ^p¥ EXEC SQL DROP TABLE :table_name; ?a ? e??  ?a ? e??  è è 2 ü°? ü°? StudentV ?K qó¨? V ?K qó¨? U1 EXEC SQL GRANT SELECT ON TABLE Student TO U1; 1a°?2T1?: c¥ 1a°?2T1?: c¥ SELECT?  ?  z ? ì T ? ì T EXEC SQL SELECT [ALL|DISTINCT] < "S Vr T "S Vr T >[,< "S Vr T "S Vr T >]... INTO <?M  ?M  >[<· UM  · UM  >] [,<?M  ?M  >[<· UM  · UM  >]]... FROM <V  jm V  jm >[,<V  jm V  jm >] ... [WHERE <HqVr T HqVr T >] [GROUP BY <   1> [HAVING <HqVr T HqVr T >]] [ORDER BY <   2> [ASC|DESC]]; °?2T1?: c¥ °?2T1?: c¥ SELECT?  ? ?  ? –?o T ?o T SELECT? ¥ ? ü ^ B? ? ¥ ? ü ^ B? INTO0  züV ? o?s?¥??Hq¥: cb üV ? o?s?¥??Hq¥: cb ? ? INTO0 ·¥?M ? ?b 0 ·¥?M ? ?b °?2T1?: c¥ °?2T1?: c¥ SELECT?  ? ?  ? z P¨?i Y[ P¨?i Y[ – 1. P¨?M  P¨?M  z INTO0  zWHERE0 ¥HqVr T 0 ¥HqVr T zHAVING ?¥HqVr T  ?¥HqVr T °?2T1?: c¥ °?2T1?: c¥ SELECT?  ? ?  ? – 2. P¨· UM  P¨· UM  z· UM o ?¨? · UM o ?¨? INTO0 ? 0 ? z ?T ?T INTO0 ??M a ??μ· UM 5 0 ??M a ??μ· UM 5 ?°?¤¥ ? ? [1 b′ H"d?1? ?°?¤¥ ? ? [1 b′ H"d?1? |M??M a ?¥· UM ?1μ′??_ |M??M a ?¥· UM ?1μ′??_ ??M 3??′?T'?M ′ ˉ ?3? ??M 3??′?T'?M ′ ˉ ?3? SQL? - -¥′ ? - -¥′ z??C· UM ′1μ′ H?5?M 1? ??C· UM ′1μ′ H?5?M 1? ′ (? a1?M ′1 ′ (? a1?M ′1 NULL °?2T1?: c¥ °?2T1?: c¥ SELECT?  ? ?  ? – 3. °?2T1 b" °?2T1 b" z ?T ? o? àμ ?@Hq¥: c'° ?T ? o? àμ ?@Hq¥: c'° ?2T1 b5 DBMS| | SQLCODE¥′ ¥′ ?1 ?1 100 – 4. °?2T1H: c °?2T1H: c z??p ??p DBMS? ? SQLCA?Ríp ?Ríp ? ? °?2T1?: c¥ °?2T1?: c¥ SELECT?  ? ?  ? è è 3 ? D 3| ?°?D 3?b ? D 3| ?°?D 3?b L !X|1°?¥D 3¥D|?ó ?M  L !X|1°?¥D 3¥D|?ó ?M  givensno EXEC SQL SELECT Sno, Sname, Ssex, Sage, Sdept INTO :Hsno, :Hname, :Hsex, :Hage, :Hdept FROM Student WHERE Sno=:givensno; – Hsno, Hname, Hsex, Hage, Hdept? ? givensno ( ^?M ( ^?M i (X - ?¥??? a üV b i (X - ?¥??? a üV b °?2T1?: c °?2T1?: c ¥ ¥ SELECT?  ? ?  ? è è 4 °? ?D 3ê?  ê [?¥?b °? ?D 3ê?  ê [?¥?b L !X|1°?¥D 3¥D|?ó ?M  L !X|1°?¥D 3¥D|?ó ?M  givensno  | [?|?ó ?M  | [?|?ó ?M  givencnob EXEC SQL SELECT Sno, Cno, Grade INTO :Hsno, :Hcno, :Hgrade:Gradeid FROM SC WHERE Sno=:givensno AND Cno=:givencno; °?2T1?: c¥ °?2T1?: c¥ SELECT?  ? ?  ? zV4ú?¨??¥ ? ? ??? I V4ú?¨??¥ ? ? ??? I n n SELECT?  ?? f ?/??? ?  ?? f ?/??? P¨3S P¨3S –??RíB?2T ? ¥ ??RíB?2T ? ¥ SELECT?  ù ?  ù ? V[? P¨3S ? V[? P¨3S –? ?T[a ? o?M ? ? ?T[a ? o?M ? SELECT?  ?  V ??Rí? ? ? H?? ü?p V ??Rí? ? ? H?? ü?p ?ad CURRENT? T¥ ? T¥ UPDATE?  ?  zd d CURRENT? T¥ ? T¥ UPDATE?  ?  – P¨?M  P¨?M  z SET0  z WHERE0  – P¨· UM  P¨· UM  z SET0  zd d CURRENT? T¥ ? T¥ UPDATE?  V[? ?  V[? THíF THíF d d CURRENT? T¥ ? T¥ UPDATE?  ? ?  ? è è 5 | ?8D 3 | ?8D 3 1| [?¥ I k?9F ? | [?¥ I k?9F ? ?sb L !9F¥s ?X?ó?M  L !9F¥s ?X?ó?M  Raise EXEC SQL UPDATE SC SET Grade=Grade+:Raise WHERE Cno='1'; d d CURRENT? T¥ ? T¥ UPDATE?  ? ?  ? è è 6 ?? ?D 3 ?? ?D 3 1| [?¥?b | [?¥?b L !?D 3¥D|X?ó?M  L !?D 3¥D|X?ó?M  givensno  ??a¥?X?ó?M  ??a¥?X?ó?M  newgradeb EXEC SQL UPDATE SC SET Grade=:newgrade WHERE Sno=:givensno; d d CURRENT? T¥ ? T¥ UPDATE?  ? ?  ? è è 7 |9 ?" ?8D 3 M -? |9 ?" ?8D 3 M -? NULL′ ′ Sageid=-1; EXEC SQL UPDATE Student SET Sage=:Raise:Sageid WHERE Sdept='CS'; d d CURRENT? T¥ ? T¥ UPDATE?  ? ?  ? –|· UM  |· UM  Sageid?B?μ′aí ??M ?B?μ′aí ??M   Raise1?′ 1?′ DBMS??| ??| CS" ?μ: " ?μ: c¥ M - ??? b′b ??N? c¥ M - ??? b′b ??N? EXEC SQL UPDATE Student SET Sage=NULL WHERE Sdept='CS'; Bad CURRENT? T¥ ? T¥ DELETE?  ?  zd d CURRENT? T¥ ? T¥ DELETE?  ?  – P¨?M  P¨?M  zWHERE0  zd d CURRENT? T¥ ? T¥ DELETE?  V[ ?  V[ ?THíF ?THíF d d CURRENT? T¥ ? T¥ DELETE?  ? ?  ? è è 8 ?D 3|D C1|μ1 e¥ ?μê [ ?D 3|D C1|μ1 e¥ ?μê [ : c ÷"?b : c ÷"?b L !?D 3¥? X?ó?M  L !?D 3¥? X?ó?M  stdname EXEC SQL DELETE FROM SC WHERE Sno= (SELECT Sno FROM Student WHERE Sname=:stdname); ta INSERT?  ?  zd d CURRENT? T¥ ? T¥ INSERT?  ?  – P¨?M  P¨?M  z VALUES0  – P¨· UM  P¨· UM  z VALUES0  zd d CURRENT? T¥ ? T¥ INSERT? BQo ? BQo ? { ?BHíF ? { ?BHíF INSERT?  ? ?  ? è è 9 ?D 3?ê?   ê [?|μ1: c? ? ?D 3?ê?   ê [?|μ1: c? ? SCV V L !D 3¥D|X?ó?M  L !D 3¥D|X?ó?M  stdno  [?|X?ó?M [?|X?ó?M   counob gradeid=-1; EXEC SQL INSERT INTO SC(Sno, Cno, Grade) VALUES(:stdno, :couno, :gr:gradeid); – ???D 3Dê? [? ? I kyN? 1 ???D 3Dê? [? ? I kyN? 1 bb ?[' è?¨· UM · UM?¥?M 1 b bb ?[' è?¨· UM · UM?¥?M 1 b ′b 3.11.4 P¨3S¥ P¨3S¥ SQL?  ?  z A? P¨3S¥ A? P¨3S¥ SQL?  ?  – °?2T1H: c¥ °?2T1H: c¥ SELECT?  ?  – CURRENT? T¥ ? T¥ UPDATE?  ?  – CURRENT? T¥ ? T¥ DELETE?  ?  Ba °?2T1H: c¥ °?2T1H: c¥ SELECT?  ?  z P¨3S¥?? P¨3S¥?? – 1. a ü3S a ü3S – 2. u 73S u 73S – 3. M?3S·? ?a |? -: c M?3S·? ?a |? -: c – 4. 1>3S 1>3S 1. a ü3S a ü3S z P¨ P¨ DECLARE?  ?  z? ì T ? ì T EXEC SQL DECLARE <3S 3S > CURSOR FOR <SELECT?  ?  >; z? ? ? ? – ^BH a ü?? ? H ^BH a ü?? ? H DBMSi?3? i?3? SELECT·?¥°??Tb ·?¥°??Tb 2. u 73S u 73S z P¨ P¨ OPEN?  ?  z? ì T ? ì T EXEC SQL OPEN <3S 3S >; z? ? ? ? – u 73S L=  ^3?M?¥ u 73S L=  ^3?M?¥ SELECT? ü ? ? ü ? μ ?@°?Hq¥: cV·?V |?? u? μ ?@°?Hq¥: cV·?V |?? u? – ? H3S)?? ?·?·_°?2T"?? ? H3S)?? ?·?·_°?2T"?? BH: c- - BH: c- - 3. M?3S·? ?a |? -: c M?3S·? ?a |? -: c z P¨ P¨ FETCH?  ?  z? ì T ? ì T EXEC SQL FETCH [[NEXT|PRIOR| FIRST|LAST] FROM] <3S 3S > INTO <?M  ?M  >[<· UM  · UM  >] [,<?M  ?M  >[<· UM  · UM  >]]...; M?3S·? ?a |? -: c M?3S·? ?a |? -: c  ? z? ? ? ? – ·?Z_w?3S·? ?a|? u?¥? -: ·?Z_w?3S·? ?a|? u?¥? -: c | ? ?à?M ??yéB?) ?b c | ? ?à?M ??yéB?) ?b – NEXT|PRIOR|FIRST|LAST ·?w?3S·?¥ ·?w?3S·?¥ Z Tb z NEXT _ -wéBH: c_ -wéBH: c z PRIOR _í|BH: c_í|BH: c z FIRST w_?BH: cw_?BH: c z LAST w_KaBH: cw_KaBH: c z ? 8′1 ? 8′1 NEXT M?3S·? ?a |? -: c M?3S·? ?a |? -: c  ? z a ü a ü – (1) ?M A?D ?M A?D SELECT? ?¥ "S Vr T  ? ?¥ "S Vr T  μBB?1" μBB?1" – (2) FETCH? Yè¨B??ì2?YV? ? Yè¨B??ì2?YV? ì3? ì3? FETCH? ?H |2T"?¥?é?) ? ? ?H |2T"?¥?é?) ? – (3) 1éB?ZL¨?) ? ? CBt1" ? 1éB?ZL¨?) ? ? CBt1" ? o5 ?"d o5 ?"d FETCH? S  ?  ?¨?_ ? ? S  ?  ?¨?_ ? iZ_[ ?i?éM?3S·? iZ_[ ?i?éM?3S·? 4. 1>3S 1>3S z P¨ P¨ CLOSE?  ?  z? ì T ? ì T EXEC SQL CLOSE <3S 3S >; z? ? ? ? – 1>3S db2T"]¨¥? u#  e'÷1>3S db2T"]¨¥? u#  e'÷ z a ü a ü – 3S$1>aü??e ?¥°?2T"M ó" 3S$1>aü??e ?¥°?2T"M ó" – $1>¥3S V[Q$u 7D?¥°?2TM $1>¥3S V[Q$u 7D?¥°?2TM ó" è5 è è 1 °? ?" ?8D 3¥? D|a? a °? ?" ?8D 3¥? D|a? a ?Y? M -b1°?¥" ?¨??? ?Y? M -b1°?¥" ?¨??? ?V??·?b?M  ?V??·?b?M  deptname? ? ...... ...... EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; è5 ? ...... /* a ü?M  a ü?M  deptname,HSno,HSname,HSsex,HSage ? ? */ ...... ...... EXEC SQL END DECLARE SECTION; ...... ...... gets(deptname); /* 1?M  1?M  deptname?′ ?′ */ ...... è5 ? EXEC SQL DECLARE SX CURSOR FOR SELECT Sno, Sname, Ssex, Sage FROM Student WHERE SDept=:deptname; /* a ü3S a ü3S */ EXEC SQL OPEN SX /* u 73S u 73S */ è5 ? WHILE(1) /* ¨?ì2?H) ?2T"?¥: c ¨?ì2?H) ?2T"?¥: c */ { EXEC SQL FETCH SX INTO :HSno, :HSname, :HSsex, :HSage; /* |3S·?_ -wéB? ?aV2 |3S·?_ -wéB? ?aV2 T"? |? -? ?M??M  T"? |? -? ?M??M  */ è5 ? if (sqlca.sqlcode <> SUCCESS) break; /* ? ?μ°?2T (X) ??C ? ?μ°?2T (X) ??C SQL? p5|?ì ? p5|?ì */ /* ???y? é?éB?) ? ???y? é?éB?) ? */ ...... ...... }; è5 ? EXEC SQL CLOSE SX; /* 1>3S 1>3S */ ...... ...... è5 ? è è 2 °? t" ?8D 3¥?b °? t" ?8D 3¥?b ...... ...... EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; ...... /* a ü?M  a ü?M  deptname,HSno,HSname,HSsex,HSage? ? */ ...... ...... è5 ? EXEC SQL END DECLARE SECTION; ...... ...... ...... EXEC SQL DECLARE SX CURSOR FOR SELECT Sno, Sname, Ssex, Sage FROM Student WHERE SDept=:deptname; /* a ü3S a ü3S */ è5 ? WHILE (gets(deptname)!=NULL) /* ¤ l?M  ¤ l?M  deptname¥′ ¥′ */ { /* / ? 7 S) ? / ? 7 S) ? deptname·?"¥D 3? ·?"¥D 3? , ?Q?ì? ?Q?ì? deptname V μ?]¥′ V μ?]¥′ */ EXEC SQL OPEN SX /* u 73S u 73S */ è5 ? WHILE (1) { /* ¨?ì2?H) ?2T"?¥: c ¨?ì2?H) ?2T"?¥: c */ EXEC SQL FETCH SX INTO :HSno, :HSname, :HSsex, :HSage; /* |3S·?_ -wéB? ?aV2T"? | |3S·?_ -wéB? ?aV2T"? | ? -? ?M??M  ? -? ?M??M  */ è5 ? if (sqlca.sqlcode <> SUCCESS) break; /* ? ?μ°?2T (X) ??C ? ?μ°?2T (X) ??C SQL? p5|?ì ? p5|?ì */ /* ???y? é?éB?) ? ???y? é?éB?) ? */ ...... ...... }; /* =?ì2 ? =?ì2 ? */ è5 ? EXEC SQL CLOSE SX; /* 1>3S 1>3S */ }; /* ??ì2 ? ??ì2 ? */ ...... ...... =a CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ?  zCURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE? ¥¨o ? ¥¨o –d d CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ?  z ?_"?¥?T ?_"?¥?T zBQ?? ÷" ?μ ?@Hq¥: c BQ?? ÷" ?μ ?@Hq¥: c =a CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ?  zCURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE? ¥¨o ? ? ¥¨o ? – ?ToX?? ÷" ? ?: c ?ToX?? ÷" ? ?: c z¨{3S¥ ¨{3S¥ SELECT? ° ?μ ?@H ? ° ?μ ?@H q¥: c q¥: c zV?éB?s1?? ÷"¥: c V?éB?s1?? ÷"¥: c z¨ ¨ CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE? ?? ÷"- ? ?? ÷"- CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ? ?  ? z?? ?? – (1) DECLARE  z a ü3S a ü3S – (2) OPEN zu 73Sü ?μ ?@°?Hq¥: c u 73Sü ?μ ?@°?Hq¥: c V·?V |à? u V·?V |à? u – (3) FETCH zwé3S·?iü? -: cV? u? wé3S·?iü? -: cV? u? | ? ?à?M  | ? ?à?M  CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ? ?  ? – (4) _°?: c ^? ^1?? ÷"¥ _°?: c ^? ^1?? ÷"¥ : c ^5) ?- : c ^5) ?-  – (5) ×ˉ? ×ˉ? (3)? ? (4)?¨?H |2T ?¨?H |2T "?¥?é? ??) ? "?¥?é? ??) ? – (6) CLOSE z1>3S db2T"]¨¥? u? 1>3S db2T"]¨¥? u?  e'÷  e'÷ CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ? ?  ? z a ü3S a ü3S –1 1 UPDATE?  a ü3S ?  a ü3S z P¨{ P¨{ FOR UPDATE OF <   > ?¥  ?¥ DECLARE?  ?  z? ì T ? ì T EXEC SQL DECLARE <3S 3S > CURSOR FOR <SELECT?  ?  > FOR UPDATE OF <   >; zFOR UPDATE OF <   > ?¨?· ü  ?¨?· ü _ ì¥ ? ·?   ^ V??¥[ _ ì¥ ? ·?   ^ V??¥[ L L DBMSé?i? e? é?i? e? CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ? ?  ? –1 1 DELETE?  a ü3S ?  a ü3S z P¨{ P¨{ FOR UPDATE ?¥  ?¥ DECLARE ?  ?  z? ì T ? ì T EXEC SQL DECLARE <3S 3S > CURSOR FOR <SELECT?  ?  > FOR UPDATE; zFOR UPDATE ?4 U DBMSé?i? é?i? e? e? CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ? ?  ? z?? ÷"? -: c ?? ÷"? -: c –ü_°? u?: c ^1?? ÷"¥: ü_°? u?: c ^1?? ÷"¥: c5¨ UPDATE?  ?  DELETE? ?? ? ??  ÷"?: c –? ì T ? ì T z<UPDATE? ?  > WHERE CURRENT OF <3S 3S > z<DELETE? ?  > WHERE CURRENT OF <3S 3S > – WHERE CURRENT OF <3S 3S >0 V U??  ÷"¥ ^?3S?KíBQ |¥: c  ÷"¥ ^?3S?KíBQ |¥: c CURRENT? T¥ ? T¥ UPDATE? ? ? ? DELETE?  ? ?  ? z?3S?l?¥ ?3S?l?¥ SELECT? {μ ? {μ UNION  ORDER BY0  H?? 0  H?? SELECT? M???l B?? V÷ ? M???l B?? V÷ ?¥ jm H? ? P¨ ?¥ jm H? ? P¨ CURRENT? T ? T ¥ ¥ UPDATE? ? ? ? DELETE?  ?  è5 è è 3  ?"¥D 3?? ¨?¥1  ?"¥D 3?? ¨?¥1 p?? ? t |¥ M -3 b p?? ? t |¥ M -3 b – ± ^ ± ^ z°? ?" ?8D 3¥? °? ?" ?8D 3¥? (1°?¥" 1°?¥" ??M  ??M  deptname·? ·? z ?a? ¨?¥1 p?? ? t: c ?a? ¨?¥1 p?? ? t: c ¥ M -3 ¥ M -3 è5 ? ...... ...... EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; ...... /* a ü?M  a ü?M  deptname,HSno,HSname,HSsex,HSage,NEWAge? ? */ ...... è5 ? ...... EXEC SQL END DECLARE SECTION; ...... ...... gets(deptname); /* 1?M  1?M  deptname?′ ?′ */ ...... è5 ? EXEC SQL DECLARE SX CURSOR FOR SELECT Sno, Sname, Ssex, Sage FROM Student WHERE SDept=:deptname FOR UPDATE OF Sage; /* a ü3S a ü3S */ EXEC SQL OPEN SX /* u 73S u 73S */ è5 ? WHILE(1) {/* ¨?ì2?H) ?2T"?¥: c ¨?ì2?H) ?2T"?¥: c */ EXEC SQL FETCH SX INTO :HSno, :HSname, :HSsex, :HSage; /* |3S·?_ -wéB? ?aV2T" |3S·?_ -wéB? ?aV2T" ? |? -? ?M??M  ? |? -? ?M??M  */ è5 ? if (sqlca.sqlcode <> SUCCESS) break; /* ? ?μ°?2T (X) ?? ? ?μ°?2T (X) ?? C C SQL? p5|?ì ? p5|?ì */ printf("%s, %s, %s, %d", Sno, Sname, Ssex, Sage); /* A U?: c A U?: c */ printf("UPDATE AGE ? "); /* ù¨? ^?1?? ù¨? ^?1?? */ scanf("%c",&yn); è5 ? if (yn='y' or yn='Y') /* 31?? 31?? */ { printf("INPUT NEW AGE: "); scanf("%d",&NEWAge); /* { ??¥ M -′ { ??¥ M -′ */ EXEC SQL UPDATE Student SET Sage=:NEWAge WHERE CURRENT OF SX; /* ??? -: c¥ M -3 ??? -: c¥ M -3 */ }; è5 ? ...... ...... }; EXEC SQL CLOSE SX; /* 1>3S 1>3S */ ...... ...... è5 ? è è 4  ?"¥D 3?? ¨?¥1 p ÷  ?"¥D 3?? ¨?¥1 p ÷ " ? t |¥: cb " ? t |¥: cb ...... ...... EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; ...... /* a ü?M  a ü?M  deptname,HSno,HSname,HSsex,HSage? ? */ è5 ? ...... ...... EXEC SQL END DECLARE SECTION; ...... ...... gets(deptname); /* 1?M  1?M  deptname?′ ?′ */ ...... è5 ? EXEC SQL DECLARE SX CURSOR FOR SELECT Sno, Sname, Ssex, Sage FROM Student WHERE SDept=:deptname FOR UPDATE; /* a ü3S a ü3S */ EXEC SQL OPEN SX /* u 73S u 73S */ è5 ? WHILE(1){ /* ¨?ì2?H) ?2T"?¥: ¨?ì2?H) ?2T"?¥: c c */ EXEC SQL FETCH SX INTO :HSno, :HSname, :HSsex, :HSage; /* |3S·?_ -wéB? ?aV2 |3S·?_ -wéB? ?aV2 T"? |? -? ?M??M  T"? |? -? ?M??M  */ è5 ? if (sqlca.sqlcode <> SUCCESS) break; /* ? ?μ°?2T (X) ?? ? ?μ°?2T (X) ?? C C SQL? p5|?ì ? p5|?ì */ printf("%s, %s, %s, %d", Sno, Sname, Ssex, Sage); /* A U?: c A U?: c */ è5 ? printf("DELETE ? "); /* ù¨? ^?1 ÷" ù¨? ^?1 ÷" */ scanf("%c",&yn); if (yn='y' or yn='Y') /* 31 ÷" 31 ÷" */ EXEC SQL DELETE FROM Student WHERE CURRENT OF SX; /* ÷"? -: c ÷"? -: c */ è5 ? ...... ...... }; EXEC SQL CLOSE SX; /* 1>3S 1>3S */ ...... ...... 3.11 3 ? ? T T SQL 3.11.1 3 ? T 3 ? T SQL¥B?? T ¥B?? T 3.11.2 3 ? T 3 ? T SQL? D??y-W¥Y? ? D??y-W¥Y? 3.11.3 ?¨3S¥ ?¨3S¥ SQL?  ?  3.11.4 P¨3S¥ P¨3S¥ SQL?  ?  3.11.5 ? ? ? ? SQLeo eo 3.11.5 ? ? ? ? SQLeo eo zá ? 3 ? T á ? 3 ? T SQL z? ? 3 ? T ? ? 3 ? T SQL Baá ? SQL¥+? ¥+? z¨? V[???V??? L=3 ¨? V[???V??? L=3 1 { ? 1 { ? WHERE0  0  HAVING0 ? 0 ? tM ¥ tM ¥ ′ ′ b z? ??M ¥ ? ??M ¥ ? ?D ? ?? ? ?D ? ?? ?I ?I r H? ^ ??¥oμ ^?M ¥ r H? ^ ??¥oμ ^?M ¥ ′ ′ ^ ^ ???V??? ? { ?¥b ???V??? ? { ?¥b á ? á ? SQL¥?@ ¥?@ á ? á ? SQL? 4¥I? ? 4¥I? 2? 2? ? f ?/ ? f ?/ ˉA¤?@? ?I÷1Y¨¥??b ˉA¤?@? ?I÷1Y¨¥??b 3 p 3 p è è SC  – ? [? =X°ê?  ê [?¥ ?μD 3¥D ? [? =X°ê?  ê [?¥ ?μD 3¥D |# ? |# ? –?? ?X° ?D 3ê?¥ ?μ [?¥ [? ?? ?X° ?D 3ê?¥ ?μ [?¥ [? |#M?? |#M?? –D 3X° ?D 3ê?  ê [?¥? D 3X° ?D 3ê?  ê [?¥? '°? '°? Hq ^? ?? Hq ^? ?? ¥1°?¥ ¥1°?¥ ??  ??  9 ^? ??¥ ^? ??¥ =a? ? SQL 1. I 1 ^? ? 3 ? T I 1 ^? ? 3 ? T SQL – ? ? ? ? SQLZE ????V?? " H ZE ????V?? " H “F   ”SQL? b 2. ?¨S? ?¨S? –   ?Ir ?Ir H/ ?? ? ?? H H/ ?? ? ?? H z SQL? ?ó? ?ó z ?M ? ??M ? ? z ?M ¥ ? ???M ¥ ? ?? z SQL? ??¨¥ ? o` a ì?a'Va jm? ??¨¥ ? o` a ì?a'Va jm ? ? ? ? ? SQL ? 3. ? ? ? ? SQL¥? T ¥? T – ?  VM ?  VM z " H/??¥ " H/??¥ SQL? ?  – Hq VM Hq VM z WHERE0 ?¥Hq ?¥Hq z HAVING ??¥Hq ??¥Hq – ? o`a°?Hq ( VM ? o`a°?Hq ( VM z SELECT0 ?¥  ?¥  z FROM0 ?¥V  jm 0 ?¥V  jm z WHERE0 ?¥Hq ?¥Hq z HAVING ??¥Hq ??¥Hq ? ? ? ? SQL ? 4. è¨? ? è¨? ? SQL?  ?  – EXECUTE IMMEDIATE – PREPARE – EXECUTE – DESCRIBE z P¨? ? P¨? ? SQL/ ?÷¥ ^ #?? ! / ?÷¥ ^ #?? ! 9Z ?¥? M7? ^ 9Z ?¥? M7? ^ SQL?y' & ?y' & 3.11 l l 2 2 SQL¥+? ¥+? –?8?dB 8?dB – 2.dV?? dV?? – 3. ?_"?¥?TZ T ?_"?¥?TZ T – 4.]B??E24 ? P¨Z T ]B??E24 ? P¨Z T – 5.?ye?^D^¨ ?ye?^D^¨ l2 ? l2 ? ?o T ?o T SQL – ? ?l ? ?l –°? °? – ? ÷? ? ÷? – ? e? ? e? l2 ? l2 ? V 3.1 SQL?y¥?M SQL ? ? ? M ? ° ? SELECT ? ? l CREATEDROPALTER ? ? : INSERT  UPDATE  DELETE ? e ? GRANT REVOKE l2 ? l2 ? 3 ? T 3 ? T SQL – D??y¥Y?Z T D??y¥Y?Z T 1. SQLY? u Y? u – _??y.?_??y.? SQL? ¥3? ??? ¥3? ?? 2. ?M  ?M  – 1??y_??y_ SQL? 4? ?? 4? ? – 2| SQL? °? ? o¥2T???yéB?) ?? °? ? o¥2T???yéB?) ? 3. 3S 3S – 3 %"???T?yDV???T?y¥? ? ¥3 %"???T?yDV???T?y¥? ? ¥ l2 ? l2 ? 3 ? T 3 ? T SQL(? ? ) – á ? á ? SQL z?¨3S ?¨3S – ?31Rí2T ? ¥?31Rí2T ? ¥ SQL? ?  – oRíBH2T¥oRíBH2T¥ SQL? ?  z P¨3S P¨3S – a ü3S a ü3S – u 73Su 73S – wé3Si |? -: cwé3Si |? -: c – 1>3S1>3S – ? ? ? ? SQL 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T ?q ?T"d DBMS ?¨"d 7?y  ?¨"d z 'v ? ? o"d9¥8"2 ? μ 'v ? ? o"d9¥8"2 ? μ ?)  T¥+? ?)  T¥+? z  T P¨?y í ? ???  ? 2 ?1  T P¨?y í ? ???  ? 2 ?1 9 ?¤ sb?y í ??ìa ? V? ?? 9 ?¤ sb?y í ??ìa ? V? ?? %?b z ?)  T ^ ? ¥ ??`)Y ?)  T ^ ? ¥ ??`)Y – ?  T ¨?  T ?  T ¨?  T –  T ?  T  T ?  T – =  T i%  T =  T i%  T 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T ?)  T? ^) ? ? ¥2 Ob ? o O ?¨ ?¨ A ?¨ ?¨ B ?¨ ?¨ C ?¨ ?¨ D ?¨ ?¨ E ?  T ?  T 1 ?  T ?  T 2 ?  T ?  T 3  T  T =  T =  T ? o ? o ?  T?  T /  T?`  T?`  T  T / =  T?` =  T?` 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T z1  LC ??`aQ¥ ó"?D 1  LC ??`aQ¥ ó"?D ? o"d? ?)  T?4  a ? o"d? ?)  T?4  a ?^ ?^ –?  T ?  T /  T?^  T?^ –  T  T / =  T?^ =  T?^ 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 1.  T  T – ? o? ?? ? ¥ ? 2?+?¥ í ? o? ?? ? ¥ ? 2?+?¥ í ? ^ ?μ¨?¥ jmb ? ^ ?μ¨?¥ jmb – ?D 8¥?¨??# P¨¥ú)?? !9 ?D 8¥?¨??# P¨¥ú)?? !9 ?yí1b – ? ¥ jmYè[ B? ? ?1 ? ¥ jmYè[ B? ? ?1 $b –¨  T í ??y  T ¨  T í ??y  T DDL í ? ?  ? í ? ?  ?  ¥ jmb  ¥ jmb 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 2. ?  T ?  T – ^ ? ¨? A?¥ ? jm'D B?¨μ1¥ ^ ? ¨? A?¥ ? jm'D B?¨μ1¥ ? ¥ ? V Ub – ?  TYè ^  T¥0"?]¨?¥?  T¥ í ?  TYè ^  T¥0"?]¨?¥?  T¥ í ? V[?]b – ?]¨?¥?  T V[oM-?]B?  T V[ ?]¨?¥?  T V[oM-?]B?  T V[ 1 B¨?¥??¨ ? P¨B??¨??o ? 1 B¨?¥??¨ ? P¨B??¨??o ? P¨B??  Tb P¨B??  Tb – ¨?  T í ??y ¨?  T í ??y (?  T ?  T DDL) í ?¨? ? j í ?¨? ? j mb 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 3. =  T =  T – ^ ?  ? o"d =?¥V U' ? ^ ?  ? o"d =?¥V U' ? ¥t ?2?i%Z T¥ í ?b ¥t ?2?i%Z T¥ í ?b è ?: c ^ ¨?i%? ^?v è ?: c ^ ¨?i%? ^?v B ?2i ?2i % ^?v % ^?v hashZEi% ì?¥F?Z ZEi% ì?¥F?Z T ^ I 1 ? ^?a êa ^?F á ? T ^ I 1 ? ^?a êa ^?F á ? ¥i%: c2¥???b ¥i%: c2¥???b –¨ =  T í ??y ¨ =  T í ??y ( =  T =  T DDL) ? í ??? ? í ??? lb 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 4. =)?^ =)?^ – ?  T ?  T /  T¥?^?l B??  T?  T-  T¥?^?l B??  T?  T- W¥?1"b?  T?M H?  T W¥?1"b?  T?M H?  T /  T¥?  T¥? ^1TM?¥?M[ £?  T ??Mb £ ^1TM?¥?M[ £?  T ??Mb £  ? ¥ ? ? ??  ? ¥ ? ? ?? –  T  T / =  T¥?^?l ? ? 2?i%2 =  T¥?^?l ? ? 2?i%2 -W¥?1"]"? ? o¥i%2? -W¥?1"]"? ? o¥i%2? M H  T M H  T / =  T¥?^9A?TM?¥?? =  T¥?^9A?TM?¥?? P¤  T ??Mb £  ? ¥t ?? ?? P¤  T ??Mb £  ? ¥t ?? ?? 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 5. ?]¨? P¨¥ ? jm ?]¨? P¨¥ ? jm ?¨"d ?¨"d DBMS OS DB =  T =  T  T  T ?  T ?  T ? ? K?¨? K?¨? ?¨ ?¨ ??? ??? DBA 3.13 ? o"d¥ ?)  T ? o"d¥ ?)  T 6. ?)  T¥a? ?)  T¥a? – £ ? ¥? ??  £ ? ¥? ?? –e? ¨?¤ gZL ¨? P¨ e? ¨?¤ gZL ¨? P¨ –μ ?? ?  Z μ ?? ?  Z –μ ?? ? ? ? á μ ?? ? ? ? á