¡¡¡¡¿ª·¢Êý¾Ý¿â¹ÜÀíÀàµÄÈí¼þ£¬²»¿ÉÄܲ»¿¼ÂǶàÓû§ºÍÓû§È¨ÏÞÉèÖõÄÎÊÌâ¡£¾¡¹ÜÄ¿Ç°ÊÐÃæÉϵĴó¡¢ÖÐÐ͵ĺǫ́Êý¾Ý¿âϵͳÈí¼þ¶¼ÌṩÁ˶àÓû§£¬ÒÔ¼°Ï¸ÖÁij¸öÊý¾Ý¿âÄÚijÕűíµÄȨÏÞÉèÖõŦÄÜ£¬ÎÒ¸öÈ˽¨Ò飺һÌ׳ÉÊìµÄÊý¾Ý¿â¹ÜÀíÈí¼þ£¬»¹ÊÇÓ¦¸Ã×ÔÐÐÉè¼ÆÓû§¹ÜÀíÕâ¿é¹¦ÄÜ£¬ÔÒòÓжþ£º
¡¡¡¡1.ÄÇЩ´ó¡¢ÖÐÐͺǫ́Êý¾Ý¿âϵͳÈí¼þËùÌṩµÄ¶àÓû§¼°ÆäȨÏÞÉèÖö¼ÊÇÕë¶ÔÊý¾Ý¿âµÄ¹²ÓÐÊôÐÔ£¬²¢²»Ò»¶¨ÄÜÍêÈ«Âú×ãijЩÌØÀýµÄÐèÇó£»
¡¡¡¡2.²»Òª¹ý¶àµÄÒÀÀµºǫ́Êý¾Ý¿âϵͳÈí¼þµÄijЩÌØÊ⹦ÄÜ£¬¶àÖÖ´ó¡¢ÖÐÐͺǫ́Êý¾Ý¿âϵͳÈí¼þÖ®¼ä²¢²»ÍêÈ«¼æÈÝ¡£·ñÔòÒ»µ©ÈÕºóÐèҪת»»Êý¾Ý¿âƽ̨»òºǫ́Êý¾Ý¿âϵͳÈí¼þ°æ±¾Éý¼¶£¬Ö®Ç°µÄ¼Ü¹¹Éè¼ÆºÜ¿ÉÄÜÎÞ·¨ÖØÓá£
¡¡¡¡ÏÂÃæ¿´¿´ÈçºÎ×ÔÐÐÉè¼ÆÒ»ÌױȽÏÁé»îµÄ¶àÓû§¹ÜÀíÄ£¿é£¬¼´¸ÃÊý¾Ý¿â¹ÜÀíÈí¼þµÄϵͳ¹ÜÀíÔ±¿ÉÒÔ×ÔÐÐÌí¼ÓÐÂÓû§£¬ÐÞ¸ÄÒÑÓÐÓû§µÄȨÏÞ£¬É¾³ýÒÑÓÐÓû§¡£Ê×ÏÈ£¬·ÖÎöÓû§ÐèÇó£¬Áгö¸ÃÊý¾Ý¿â¹ÜÀíÈí¼þËùÓÐÐèҪʵÏֵŦÄÜ£»È»ºó£¬¸ù¾ÝÒ»¶¨µÄÁªÏµ¶ÔÕâЩ¹¦ÄܽøÐзÖÀ࣬¼´°ÑijÀàÓû§ÐèʹÓõŦÄܹéΪһÀࣻ×îºó¿ªÊ¼½¨±í£º
¡¡¡¡
¹¦Äܱí(Function_table)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
f_id int ¡¡ ÎÞÖظ´¡¡¡¡ ¹¦Äܱêʶ£¬Ö÷¼ü
f_name char(20) ²»ÔÊÐíΪ¿Õ ¹¦ÄÜÃû³Æ£¬²»ÔÊÐíÖظ´
f_desc char(50) ÔÊÐíΪ¿Õ ¹¦ÄÜÃèÊö
Óû§×é±í(User_group)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
group_id int ÎÞÖظ´ Óû§×é±êʶ£¬Ö÷¼ü
group_name char(20) ²»ÔÊÐíΪ¿Õ Óû§×éÃû³Æ
group_power char(100) ²»ÔÊÐíΪ¿Õ Óû§×éȨÏÞ±í£¬ÄÚÈÝΪ¹¦Äܱíf_idµÄ¼¯ºÏ
Óû§±í(User_table)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
user_id int ÎÞÖظ´ Óû§±êʶ£¬Ö÷¼ü
user_name char(20) ÎÞÖظ´ Óû§Ãû
user_pwd char(20) ²»ÔÊÐíΪ¿Õ Óû§ÃÜÂë
user_type int ²»ÔÊÐíΪ¿Õ ËùÊôÓû§×é±êʶ£¬ºÍUser_group.group_id¹ØÁª
¡¡¡¡²ÉÓÃÕâÖÖÓû§×éµÄ¼Ü¹¹Éè¼Æ£¬µ±ÐèÒªÌí¼ÓÐÂÓû§Ê±£¬Ö»ÐèÖ¸¶¨ÐÂÓû§ËùÊôµÄÓû§×飻µ±ÒÔºóϵͳÐèÒªÌí¼Óй¦ÄÜ»ò¶Ô¾ÉÓй¦ÄÜȨÏÞ½øÐÐÐÞ¸Äʱ£¬Ö»ÓòÙ×÷¹¦ÄܱíºÍÓû§×é±íµÄ¼Ç¼£¬ÔÓÐÓû§µÄ¹¦Äܼ´¿ÉÏàÓ¦ËæÖ®±ä»¯¡£µ±È»£¬ÕâÖּܹ¹Éè¼Æ°ÑÊý¾Ý¿â¹ÜÀíÈí¼þµÄ¹¦ÄÜÅж¨ÒƵ½ÁËǰ̨£¬Ê¹µÃǰ̨¿ª·¢Ïà¶Ô¸´ÔÓһЩ¡£µ«ÊÇ£¬µ±Óû§Êý½Ï´ó(10ÈËÒÔÉÏ)£¬»òÈÕºóÈí¼þÉý¼¶µÄ¸ÅÂʽϴóʱ£¬Õâ¸ö´ú¼ÛÊÇÖµµÃµÄ¡£
¡¡¡¡ËÄ¡¢¼ò½àµÄÅúÁ¿m:nÉè¼Æ
¡¡¡¡Åöµ½m:nµÄ¹Øϵ£¬Ò»°ã¶¼Êǽ¨Á¢3¸ö±í£¬mÒ»¸ö£¬nÒ»¸ö£¬m:nÒ»¸ö¡£µ«ÊÇ£¬m:nÓÐʱ»áÓöµ½ÅúÁ¿´¦ÀíµÄÇé¿ö£¬ÀýÈ絽ͼÊé¹Ý½èÊ飬һ°ã¶¼ÊÇÔÊÐíÓû§Í¬Ê±½èÔÄn±¾Ê飬Èç¹ûÒªÇó°´Åú²éѯ½èÔļǼ£¬¼´Áгöij¸öÓû§Ä³´Î½èÔĵÄËùÓÐÊé¼®£¬¸ÃÈçºÎÉè¼ÆÄØ£¿ÈÃÎÒÃǽ¨ºÃ±ØÐëµÄ3¸ö±íÏÈ£º
Êé¼®±í(Book_table)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
book_id int ÎÞÖظ´ Êé¼®±êʶ£¬Ö÷¼ü
book_no char(20) ÎÞÖظ´ Êé¼®±àºÅ
book_name char(100) ²»ÔÊÐíΪ¿Õ Êé¼®Ãû³Æ
¡¡
½èÔÄÓû§±í(Renter_table)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
renter_id int ÎÞÖظ´ Óû§±êʶ£¬Ö÷¼ü
renter_name char(20) ²»ÔÊÐíΪ¿Õ Óû§ÐÕÃû
¡¡
½èÔļǼ±í(Rent_log)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
rent_id int ÎÞÖظ´ ½èÔļǼ±êʶ£¬Ö÷¼ü
r_id int ²»ÔÊÐíΪ¿Õ Óû§±êʶ£¬ºÍRenter_table.renter_id¹ØÁª
b_id int ²»ÔÊÐíΪ¿Õ Êé¼®±êʶ£¬ºÍBook_table.book_id¹ØÁª
rent_date datetime ²»ÔÊÐíΪ¿Õ ½èÔÄʱ¼ä
¡¡
¡¡¡¡ÎªÁËʵÏÖ°´Åú²éѯ½èÔļǼ£¬ÎÒÃÇ¿ÉÒÔÔÙ½¨Ò»¸ö±íÀ´±£´æÅúÁ¿½èÔĵÄÐÅÏ¢£¬ÀýÈ磺
ÅúÁ¿½èÔıí(Batch_rent)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
batch_id int ÎÞÖظ´ ÅúÁ¿½èÔıêʶ£¬Ö÷¼ü
batch_no int ²»ÔÊÐíΪ¿Õ ÅúÁ¿½èÔıàºÅ£¬Í¬Ò»Åú½èÔĵÄbatch_noÏàͬ
rent_id int ²»ÔÊÐíΪ¿Õ ½èÔļǼ±êʶ£¬ºÍRent_log.rent_id¹ØÁª
batch_date datetime ²»ÔÊÐíΪ¿Õ ÅúÁ¿½èÔÄʱ¼ä
¡¡¡¡ÕâÑùµÄÉè¼ÆºÃÂð£¿ÎÒÃÇÀ´¿´¿´ÎªÁËÁгöij¸öÓû§Ä³´Î½èÔĵÄËùÓÐÊé¼®£¬ÐèÒªÈçºÎ²éѯ£¿Ê×ÏȼìË÷ÅúÁ¿½èÔıí(Batch_rent)£¬°Ñ·ûºÏÌõ¼þµÄµÄËùÓмǼµÄrent_id×ֶεÄÊý¾Ý±£´æÆðÀ´£¬ÔÙÓÃÕâЩÊý¾Ý×÷Ϊ²éѯÌõ¼þ´øÈëµ½½èÔļǼ±í(Rent_log)ÖÐÈ¥²éѯ¡£ÄÇô£¬ÓÐûÓÐʲô°ì·¨¸Ä½øÄØ£¿ÏÂÃæ¸ø³öÒ»ÖÖ¼ò½àµÄÅúÁ¿Éè¼Æ·½°¸£¬²»ÐèÌí¼ÓÐÂ±í£¬Ö»ÐèÐÞ¸ÄһϽèÔļǼ±í(Rent_log)¼´¿É¡£Ð޸ĺóµÄ¼Ç¼±í(Rent_log)ÈçÏ£º
½èÔļǼ±í(Rent_log)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
rent_id int ÎÞÖظ´ ½èÔļǼ±êʶ£¬Ö÷¼ü
r_id int ²»ÔÊÐíΪ¿Õ Óû§±êʶ£¬ºÍRenter_table.renter_id¹ØÁª
b_id int ²»ÔÊÐíΪ¿Õ Êé¼®±êʶ£¬ºÍBook_table.book_id¹ØÁª
batch_no int ²»ÔÊÐíΪ¿Õ ÅúÁ¿½èÔıàºÅ£¬Í¬Ò»Åú½èÔĵÄbatch_noÏàͬ
rent_date datetime ²»ÔÊÐíΪ¿Õ ½èÔÄʱ¼ä
¡¡
¡¡¡¡ÆäÖУ¬Í¬Ò»´Î½èÔĵÄbatch_noºÍ¸ÃÅúµÚÒ»ÌõÈë¿âµÄrent_idÏàͬ¡£¾ÙÀý£º¼ÙÉ赱ǰ×î´órent_idÊÇ64£¬½Ó×ÅijÓû§Ò»´Î½èÔÄÁË3±¾Ê飬ÔòÅúÁ¿²åÈëµÄ3Ìõ½èÔļǼµÄbatch_no¶¼ÊÇ65¡£Ö®ºóÁíÍâÒ»¸öÓû§×âÁËÒ»Ì×µú£¬ÔÙ²åÈë³ö×â¼Ç¼µÄrent_idÊÇ68¡£²ÉÓÃÕâÖÖÉè¼Æ£¬²éѯÅúÁ¿½èÔĵÄÐÅϢʱ£¬Ö»ÐèʹÓÃÒ»Ìõ±ê×¼T_SQLµÄǶÌײéѯ¼´¿É¡£µ±È»£¬ÕâÖÖÉè¼Æ²»·ûºÏ3NF£¬µ«ÊǺÍÉÏÃæ±ê×¼µÄ3NFÉè¼Æ±ÈÆðÀ´£¬ÄÄÒ»ÖÖ¸üºÃÄØ£¿´ð°¸¾Í²»ÓÃÎÒ˵ÁË°É¡£
¡¡¡¡Îå¡¢ÈßÓàÊý¾ÝµÄÈ¡Éá
¡¡¡¡ÉÏƪµÄ¡°Ê÷Ð͹ØϵµÄÊý¾Ý±í¡±Öб£ÁôÁËÒ»¸öÈßÓà×ֶΣ¬ÕâÀïµÄÀý×Ó¸ü½øÒ»²½----Ìí¼ÓÁËÒ»¸öÈßÓà±í¡£ÏÈ¿´¿´Àý×Ó£ºÎÒÔÏÈËùÔڵĹ«Ë¾ÎªÁ˽â¾öÔ±¹¤µÄ¹¤×÷²Í£¬ºÍ¸½½üµÄÒ»¼ÒС²Í¹ÝÁªÏµ£¬Ã¿Ìì³Ô·¹¼ÇÕË£¬·ÑÓð´ÈËÊýƽ̯£¬Ôµ×Óɹ«Ë¾ÏÖ½ð½áË㣬ÿ¸öÈËÿ¸öԵŤ×÷²Í·Ñ´Ó¹¤×ÊÖп۳ý¡£µ±È»£¬Ã¿Ìì³Ô·¹µÄÈËÔ±ºÍÈËÊý¶¼²»Êǹ̶¨µÄ£¬¶øÇÒ£¬ÓÉÓÚÿ¶Ù¹¤×÷²ÍµÄËùµãµÄ²ËÉ«²»Í¬£¬Ã¿¶ÙµÄ»¨·ÑÒ²²»Ïàͬ¡£ÀýÈ磬ÐÇÆÚÒ»ÖвÍ5ÈË»¨·Ñ40Ôª£¬Íí²Í2ÈË»¨·Ñ20£¬ÐÇÆÚ¶þÖвÍ6ÈË»¨·Ñ36Ôª£¬Íí²Í3ÈË»¨·Ñ18Ôª¡£ÎªÁË·½±ã¼ÆËãÿ¸öÈËÿ¸öԵŤ×÷²Í·Ñ£¬ÎÒдÁËÒ»¸ö¼òªµÄ¾Í²Í¼ÇÕ˹ÜÀí³ÌÐò£¬Êý¾Ý¿âÀïÓÐ3¸ö±í£º
Ô±¹¤±í(Clerk_table)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
clerk_id int ÎÞÖظ´ Ô±¹¤±êʶ£¬Ö÷¼ü
clerk_name char(10) ²»ÔÊÐíΪ¿Õ Ô±¹¤ÐÕÃû
ÿ²Í×ܱí(Eatdata1)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
totle_id int ÎÞÖظ´ ÿ²Í×ܱí±êʶ£¬Ö÷¼ü
persons char(100) ²»ÔÊÐíΪ¿Õ ¾Í²ÍÔ±¹¤µÄÔ±¹¤±êʶ¼¯ºÏ
eat_date datetime ²»ÔÊÐíΪ¿Õ ¾Í²ÍÈÕÆÚ
eat_type char(1) ²»ÔÊÐíΪ¿Õ ¾Í²ÍÀàÐÍ£¬ÓÃÀ´Çø·ÖÖС¢Íí²Í
totle_price money ²»ÔÊÐíΪ¿Õ ÿ²Í×Ü»¨·Ñ
persons_num int ²»ÔÊÐíΪ¿Õ ¾Í²ÍÈËÊý
¾Í²Í¼Æ·Ñϸ±í(Eatdata2)
Ãû³Æ¡¡¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡Ô¼ÊøÌõ¼þ¡¡¡¡¡¡ËµÃ÷
id int ÎÞÖظ´ ¾Í²Í¼Æ·Ñϸ±í±êʶ£¬Ö÷¼ü
t_id int ²»ÔÊÐíΪ¿Õ ÿ²Í×ܱí±êʶ£¬ºÍEatdata1.totle_id¹ØÁª
c_id int ²»ÔÊÐíΪ¿Õ Ô±¹¤±êʶ±êʶ£¬ºÍClerk_table.clerk_id¹ØÁª
price money ²»ÔÊÐíΪ¿Õ ÿÈËÿ²Í»¨·Ñ
¡¡¡¡ÆäÖУ¬¾Í²Í¼Æ·Ñϸ±í(Eatdata2)µÄ¼Ç¼¾ÍÊÇ°Ñÿ²Í×ܱí(Eatdata1)µÄÒ»Ìõ¼Ç¼°´¾Í²ÍÔ±¹¤Æ½Ì¯²ð¿ª£¬ÊǸö²»ÕÛ²»¿ÛµÄÈßÓà±í¡£µ±È»£¬Ò²¿ÉÒÔ°Ñÿ²Í×ܱí(Eatdata1)µÄ²¿·Ö×ֶκϲ¢µ½¾Í²Í¼Æ·Ñϸ±í(Eatdata2)ÖУ¬ÕâÑùÿ²Í×ܱí(Eatdata1)¾Í³ÉÁËÈßÓà±í£¬²»¹ýÕâÑùËùÉè¼Æ³öÀ´µÄ¾Í²Í¼Æ·Ñϸ±íÖظ´Êý¾Ý¸ü¶à£¬Ïà±ÈÀ´Ëµ»¹ÊÇÉÏÃæµÄ·½°¸ºÃЩ¡£µ«ÊÇ£¬¾ÍÊǾͲͼƷÑϸ±í(Eatdata2)Õâ¸öÈßÓà±í£¬ÔÚ×öÿÔÂÿÈ˲ͷÑͳ¼ÆµÄʱºò£¬´ó´ó¼ò»¯Á˱à³ÌµÄ¸´ÔӶȣ¬Ö»ÓÃÀàËÆÕâôһÌõ²éѯÓï¾ä¼´¿Éͳ¼Æ³öÿÈËÿÔµļIJʹÎÊýºÍ²Í·Ñ×ÜÕÊ£º
SELECT clerk_name AS personname,COUNT(c_id) as eattimes,SUM(price) AS ptprice FROM Eatdata2 JOIN Clerk_tabsle ON (c_id=clerk_id) JOIN eatdata1 ON (totleid=tid) WHERE eat_date>=CONVERT(datetime,'"&the_date&"') AND eat_date
¡¡¡¡ÏëÏóһϣ¬Èç¹û²»ÓÃÕâ¸öÈßÓà±í£¬Ã¿´Îͳ¼ÆÿÈËÿÔµIJͷÑ×ÜÕÊʱ»á¶àÂé·³£¬³ÌÐòЧÂÊÒ²¹»Çº¡£ÄÇô£¬µ½µ×ʲôʱºò¿ÉÒÔÔö¼ÓÒ»¶¨µÄÈßÓàÊý¾ÝÄØ£¿ÎÒÈÏΪÓÐ2¸öÔÔò£º
¡¡¡¡£±¡¢Óû§µÄÕûÌåÐèÇó¡£µ±Óû§¸ü¶àµÄ¹Ø×¢ÓÚ£¬¶ÔÊý¾Ý¿âµÄ¹æ·¶¼Ç¼°´Ò»¶¨µÄËã·¨½øÐд¦Àíºó£¬ÔÙÁгöµÄÊý¾Ý¡£Èç¹û¸ÃËã·¨¿ÉÒÔÖ±½ÓÀûÓúǫ́Êý¾Ý¿âϵͳµÄÄÚǶº¯ÊýÀ´Íê³É£¬´Ëʱ¿ÉÒÔÊʵ±µÄÔö¼ÓÈßÓà×ֶΣ¬ÉõÖÁÈßÓà±íÀ´±£´æÕâЩ¾¹ýËã·¨´¦ÀíºóµÄÊý¾Ý¡£ÒªÖªµÀ£¬¶ÔÓÚ´óÅúÁ¿Êý¾ÝµÄ²éѯ£¬Ð޸Ļòɾ³ý£¬ºǫ́Êý¾Ý¿âϵͳµÄЧÂÊÔ¶Ô¶¸ßÓÚÎÒÃÇ×Ô¼º±àдµÄ´úÂë¡£
¡¡¡¡£²¡¢¼ò»¯¿ª·¢µÄ¸´ÔӶȡ£ÏÖ´úÈí¼þ¿ª·¢£¬ÊµÏÖͬÑùµÄ¹¦ÄÜ£¬·½·¨Óкܶࡣ¾¡¹Ü²»±ØÒªÇó³ÌÐòÔ±¾«Í¨¾ø´ó²¿·ÖµÄ¿ª·¢¹¤¾ßºÍƽ̨£¬µ«ÊÇ»¹ÊÇÐèÒªÁ˽âÄÄÖÖ·½·¨´îÅäÄÄÖÖ¿ª·¢¹¤¾ßµÄ³ÌÐò¸ü¼ò½à£¬Ð§Âʸü¸ßһЩ¡£ÈßÓàÊý¾ÝµÄ±¾ÖʾÍÊÇÓÿռ任ʱ¼ä£¬ÓÈÆäÊÇÄ¿Ç°Ó²¼þµÄ·¢Õ¹Ô¶Ô¶¸ßÓÚÈí¼þ£¬ËùÒÔÊʵ±µÄÈßÓàÊÇ¿ÉÒÔ½ÓÊܵġ£²»¹ýÎÒ»¹ÊÇÔÚ×îºóÔÙÇ¿µ÷һϣº²»Òª¹ý¶àµÄÒÀÀµÆ½Ì¨ºÍ¿ª·¢¹¤¾ßµÄÌØÐÔÀ´¼ò»¯¿ª·¢£¬Õâ¸ö¶ÈÒªÊÇû°ÑÎպõĻ°£¬ºóÆÚά»¤Éý¼¶»áÔÔ´ó¸úÍ·µÄ¡£
kongxiaoqi_21 ÓÚ 2005-11-09 15:03:05·¢±í:
°¢ÃÖÍÓ·ð ѧº£ÎÞÑÄ... ...