17-2 資?庫查詢???資??

ƮwiHxsjqơAOڭ̥@MĪkӷjMڭ̩ҭnơA~oƮw̤j\ġC`ڭ̱Np Access ƮwiƬdߡASOۭgѹϧΨϥΪ̤]Graphic User InterfaceA²GUI^ӶidߡAoǬd̫߳iHনƮwqΪcƬd߻y]²SQLAԨz^AåiASPӤUFoǩROC

ڭ٬OH song01.mdb ӻC}ҸƮwAPIuإ/d߳]pvApUG

IAepUG

ɫusWvANiHNƪusongv[JثedߡAMuvCpGnuiffҰ۪qvAiHBJG

  1. Gڭ̥iHIWbuqW١vAMUbĤ@AAIWbuD̡۪vAMUbĤGC]άOiHWbYiC^
  2. ]wǫhGNuD̡۪v쪺uǫhvŮJuiffvC

ҧe{epUG

YndߡAiHIuCĸAo쵲GpUG

ܩaAҦCXӪƴNOiffҰ۪qCAnoӬdߵGɡAAccess |߰ݧAO_nxsoӬdߡAAiHNxsuiffҰ۪qvCUunAIoӬdߡAtΦ۵MN|qƪAXܲŦXd߷ǫhơC

ƹWA@ӬdߥiHP˵覡AҦpG

YnܡuSQL˵vAunb}d߫]ϥΡu]p˵vΡuƪ˵v^AIuCu˵vsAäUԦܡuSQL ˵vApUG

oɭ Access N|ܹ󦹬dߪ SQL OG

Hint
Access ѡu]p˵v SQL OɡAɭԷ|bƪW٩W٥[WAAH׶}ƪW٩W٤AiX{ťթΨ䥦SrC

bϥ ASP PƮwiXɡAƮwBzʿ SQL OA]AiHΡu]p˵vͧAndߡAANdഫ SQL OANӥiHK ASP {X̭FI SQL OΪkA`u²СAU@N󧹾㪺C

SQL Oyk^۵MyAݦhAHUڭ̱N|XӽdҨӮiܦpѡu]p˵vӲSQLOC

YndߡuiffҰ۪q]̦~NѪӻƧǡ^vAhiHbdߥ[Ju~vAIuƧǡvAUԿܡuvAepUG

ɥunAIuCĸAN|ܬdߵGC

Yndߡuiffb 1998 ~Ұ۪qvAhiHbu~vsWǫhAepUG

۹ SQL OpUG

SELECT song.qW, song.D۪, song.~ FROM song WHERE (((song.D۪)="iff") AND ((song.~)=1998));

HWd߱󳣬OHuBvDAYnݬݡuΡvdҡAҼ{UCdߡGu2002~qάOѱiffD۪qvAdߵepUG

yܻApGƭӱ󥲶Pɦߡ]uBvAAnd^Aڭ̴NnNrμƭȩbuǫhvP@CCpGoDZun@ӦߧYi]uΡvAOr^Aڭ̴NnNoDZbuǫhvHUPCCH Access ϧΨϥΪ̤ӶidߡAuΩҦ󳣬OuBvγOuΡvpAY޿P_ANa SQL OӹFC

bWzdߤA۹ SQL OpUG

SELECT song.qW, song.D۪, song.~ FROM song WHERE (((song.D۪)="iff")) OR (((song.~)=2002));

YndߡuqPCvAiHϥηƹkIuǫhvAuXpv\ApUG

ɷ|bdߵeh@ӦW٬uXpvCA䤺eusաvA\iHNۦPƧǫAANۦPƵX֦@AdߵepUG

d߫AGpUG

]ϥΡusաv\AҥHWzGOwgƧǹLGC۹ SQL OpUG

SELECT song.D۪ FROM song GROUP BY song.D۪;

䤤 "GROUP BY" NOusաv\AiHNۦPƵX֦@Ct@ӥ\ۦP SQL OpUG

SELECT DISTINCT song.D۪ FROM song;

dߥioۦPGAOoLkѡu]p˵vݨ DISTINCT \AuѡuSQL˵vӫwC

pGOndߡuq`ơvAiHb͡uXpvCANƹJIusաvANiHܤUԿ檺sAUAпܡuơvApUG

d߫AGpUG

Nƪ@ 11 ơC۹ SQL OpUG

SELECT Count(song.qW) AS qW٤ FROM song;

b]pd߮ɡAu]p˵vMܦnΡAɭԤ]|o͡uwPԡv~AٱoauSQL˵vӸɱjCҦpApGnduiffҰۺq`ơvA@몽ıkONuD̡۪vuǫhv]wuiffvAÿuXpvusաv\ApUG

iOAd߮ɡA|͡uǫhB⦡ŦXv~TAYΡuSQL˵vAiݨ۹ SQL OApUG SELECT Count(song.D۪) AS D۪̤ FROM song HAVING (((Count(song.D۪))="iff"));

ܩ㪺A~oͦb̫@CA] Count O@ӨơAuΨӭpƪơAҥHڭ̥iHΤʧ令G

SELECT Count(song.D۪) AS D۪̤ FROM song HAVING (((song.D۪)="iff"));

MAΡu]p˵vAo쪺epUG

Hint
Wzu]p˵veƹWIáAӥBeAo]ܦ@²檺dߥi٬O SQL RO̾AXAYn²ϧΤӪܡAϦӦxC

dߵGpUG

YndߡuC@q۹LqƥءvAhiHbuD̡۪vuXp/sաvAMbuqW١vuXp/ơvA]p˵epUG

YΡuSQL˵vAiݨ۹ SQL OApUG SELECT song.D۪, Count(song.qW) AS qW٤ FROM song GROUP BY song.D۪; dߵGpUG

Hint
ƹWAbWzdҤAĤGuOΨӭpơAҥHiHNA@wOuqW١vA]iHoP˪GC

p`u@ƪdߡAU@p`NӸƪiಣͪpʡC


JScript {]pPΡGΩAݪ ASP