¡¶Visual FoxProÊý¾Ý¿â³ÌÐòÉè¼Æ¡·ÊµÑéÖ¸µ¼Êé
ѧºÅ 99700123 99700210 99700239 99500031 99500276 99600089 99700119 99500035 ѧºÅ 99600089 99700123 99700210 99700239 99500031 99600089 99500276 99700119 99500035 99700119
33
°à¼¶ 99711 99712 99711 99512 99512 99611 99712 99512 ÐÕÃû ³Â°®½à ÀîÒ»¹â Àî»··Ò »ÆСÔ ÍõÀûȺ ÀîÐǹ⠳½¨¹ú »Æ»Ø´º ¿Î³ÌÃû Å® ÄÐ Å® Å® ÄÐ ÄÐ ÄÐ Å® ÐÔ±ð cj.dbf(ѧºÅ C(8),¿Î³ÌÃû C(20),³É¼¨ N(5,1) ³É¼¨ 92 84 56 88 69 51 65 73 94 72 ¼ÆËã»ú»ù´¡ ¼ÆËã»ú»ù´¡ ¼ÆËã»ú»ù´¡ ¸ßµÈÊýѧ ¸ßµÈÊýѧ ¸ßµÈÊýѧ ¼ÆËã»ú»ù´¡ ¸ßµÈÊýѧ ¸ßµÈÊýѧ ¼ÆËã»ú»ù´¡ ¡¶Visual FoxProÊý¾Ý¿â³ÌÐòÉè¼Æ¡·ÊµÑéÖ¸µ¼Êé
ʵÑé°Ë SQLÓïÑÔ£¨¶þ£©ÓëÊÓͼ
Ò»¡¢ÊµÑéÄ¿µÄ
1£®ÑµÁ·ÕÆÎÕSQL-SELECT²éѯÃüÁî¡£ 2£®ÊìϤ²éѯÏòµ¼µÄʹÓᣠ3£®ÕÆÎÕ²éѯÉè¼ÆÆ÷µÄʹÓᣠ4£®ÕÆÎÕÊÓͼ½¨Á¢ÃüÁî¡£ 5£®ÕÆÎÕÊÓͼÉè¼ÆÆ÷µÄʹÓᣠ¶þ¡¢ÖªÊ¶Òªµã Èý¡¢ÊµÑé×¼±¸
1£®×öºÃ×¼±¸£¬Äâ³ö²Ù×÷Ìá¸Ù£¬Ã÷È·Òª¼Ç¼µÄÊý¾Ý£»
2£®´ÓftpÉÏÏÂÔØ×Ô¼ºµÄѧºÅÎļþ¼Ðµ½±¾»úDÅÌ£¬²¢ÉèΪĬÈÏ·¾¶¡£ ËÄ¡¢ÊµÑéÄÚÈÝ
1£®ÊµÑéÒªÇó
£¨Ò»£©SQL-SELECTÃüÁî¶ÔÊý¾Ý¿âglk.dbcÍê³ÉÒÔϲéѯ¡£ £¨1£©²éѯ±írsb.dbfÖÐËùÓÐÖ°¹¤ÐÅÏ¢£¬²¢°´¹¤×÷ÈÕÆÚÉýÐòÅÅÐò¡£
£¨2£©²éѯ±írsb.dbfÖÐÖ°³ÆΪ¸±½ÌÊÚµÄÖ°¹¤±àºÅ¡¢ÐÕÃû¡¢³öÉúÈÕÆںͻù±¾¹¤×Ê£¬²¢½«½á¹ûÊä³öµ½ÆÁÄ»ÉÏ¡£
£¨3£©²éѯ±írsb.dbfÖеĽ²Ê¦µÄÈËÊý¡¢½²Ê¦µÄ»ù±¾¹¤×ʵÄƽ¾ùÖµ¡¢×î´óÖµºÍ×îСֵ¡£ £¨4£©²éѯ±írsb.dbfÖгöÉúÔÚ1965Äê7Ôµ½1975Äê6ÔµÄÖ°¹¤±àºÅ¡¢ÐÕÃû¡¢ÐԱ𡢳öÉúÈÕÆÚºÍÖ°³Æ¡£
£¨5£©Í³¼Æ±írsb.dbfÖв¿ÃŸöÊý¡£ £¨6£©Çó³ö¼ÆËã»úϵְ¹¤µÄƽ¾ù»ù±¾¹¤×Ê¡£
£¨7£©²éѯ½±Àø¹¤×Ê×î¸ßµÄÖ°¹¤µÄ±àºÅ¡¢ÐÕÃû¡¢²¿ÃÅÃû³ÆºÍ½±Àø¡£ £¨8£©Í³¼Æ¸÷²¿ÃŵÄÈËÔ±Êý¡£
£¨9£©Çó³ö¸÷¸ö²¿ÃÅ»ù±¾¹¤×Ê×ÜÊý£¬²¢ÇÒ°´»ù±¾¹¤×ÊÊý´Ó¸ßµ½µÍÅÅÁС£
£¨10£©²éѯ1980Äê¼°ÒÔºó²Î¼Ó¹¤×÷µÄ²¢ÇÒÖ°³ÆΪ½²Ê¦µÄÖ°¹¤µÄÐÕÃû¡¢¹¤×÷ÈÕÆÚ¡¢²¿ÃÅÃû¡¢Ö°³Æ¡¢½±Àø¹¤×ʺÍʵ·¢¹¤×Ê£¬²¢°´Êµ·¢¹¤×ʽµÐòÅÅÐòÊä³ö¡£
£¨11£©²éѯְ¹¤µÄÐÕÃû¡¢²¿ÃÅÃû¡¢Ö°³Æ¡¢½±Àø¹¤×ʺͻù±¾¹¤×Ê£¬ÒªÇóÏÈ°´½±Àø¹¤×ʵĽµÐòÊä³öµ½Îı¾Îļþwb.txt¡£
2£®²Ù×÷²½Öè
£¨1£©SELECT * FROM rsb ORDER BY ¹¤×÷ÈÕÆÚ
£¨2£©SELELCT ±àºÅ,ÐÕÃû,³öÉúÈÕÆÚ,»ù±¾¹¤×Ê FROM rsb WHERE Ö°³Æ=¡°¸±½ÌÊÚ¡±;
34
¡¶Visual FoxProÊý¾Ý¿â³ÌÐòÉè¼Æ¡·ÊµÑéÖ¸µ¼Êé
TO SCREEN
£¨3£©SELECT CNT(*) AS ½²Ê¦ÈËÊý,AVG(»ù±¾¹¤×Ê) AS ƽ¾ù¹¤×Ê,MAX(»ù±¾¹¤×Ê) AS;
×î´óÖµ,MIN(»ù±¾¹¤×Ê) AS ×îСֵ FROM rsb WHERE Ö°³Æ=¡°½²Ê¦¡± £¨4£©SELECT ±àºÅ,ÐÕÃû,ÐÔ±ð,³öÉúÈÕÆÚ,Ö°³Æ FROM rsb WHERE ; ³öÉúÈÕÆÚ>={^1965/7/1} AND³öÉúÈÕÆÚ<{^1975/7/1} £¨5£©SELECT CNT£¨DISTINCT ²¿ÃÅ´úÂ룩AS ²¿ÃŸöÊý FROM rsb
º¯ÊýCNT(DISTINCT<±í´ïʽ>)ͳ¼Æ±íÖмǼµÄ¸öÊý¡£ÓÐDISTINCTÑ¡Ïîʱ£¬Í³¼Æ¼Ç¼±í´ïʽֵÏàͬµÄ¼Ç¼£¬Ö»Í³¼ÆÒ»Ìõ¡£
£¨6£©SELECT bmdm.²¿ÃÅÃû³Æ,AVG(»ù±¾¹¤×Ê) AS ƽ¾ù¹¤×Ê FROM rsb INNER JOIN;
bmdm ON rsb.²¿ÃÅ´úÂë=bmdm.´úÂë WHERE bmdm.²¿ÃÅÃû³Æ=¡°¼ÆËã»úϵ¡± £¨7£©SELECT rsb.±àºÅ, rsb.ÐÕÃû,bmdm.²¿ÃÅÃû³Æ,gzb.½±Àø FROM rsb INNER JOIN; Bmdm INNER JOIN gzb ON rsb.²¿ÃÅ´úÂë=bmdm.´úÂë ON rsb.±àºÅ=gzb.±àºÅ; WHERE gzb.½±Àø(SELECT MAX(½±Àø) FROM gzb)
£¨8£©SELECT bmdm.²¿ÃÅÃû³Æ,CNT(*) AS ÈËÊý FROM rsb INNER JOIN bmdm ON ; rsb.²¿ÃÅ´úÂë= bmdm.´úÂë GROUP bmdm.²¿ÃÅÃû³Æ
£¨9£©SELECT bmdm.²¿ÃÅÃû³Æ,SUM(rsb.»ù±¾¹¤×Ê) AS »ù±¾¹¤×Ê×ÜÊý FROM rsb; INNER JOIN bmdm ON rsb.²¿ÃÅ´úÂë=bmdm.´úÂë GROUP BY bmdm.²¿ÃÅÃû³Æ; ORDER BY 2 DESC
£¨10£©SELECT rsb.ÐÕÃû,rsb.¹¤×÷ÈÕÆÚ,bmdm.²¿ÃÅÃû³Æ, rsb.Ö°³Æ,gzb.½±Àø,; gzb.ʵ·¢¹¤×Ê FROM rsb,bmdm,gzb WHERE rsb.²¿ÃÅ´úÂë= bmdm.´úÂë; .AND. rsb.±àºÅ .AND.YEAR(rsb.¹¤×÷ÈÕÆÚ)>=1980 .AND.Ö°³Æ¡°½²Ê¦¡±; ORDER BY ʵ·¢¹¤×Ê DESC
£¨11£©SELECT rsb.ÐÕÃû, bmdm.²¿ÃÅÃû³Æ, rsb.Ö°³Æ,gzb.½±Àø£¬rsb.»ù±¾¹¤×Ê£» FROM rsb,bmdm,gzb WHERE rsb.²¿ÃÅ´úÂë= bmdm.´úÂë .AND. rsb.±àºÅ£» =gzb.±àºÅ ORDER BY gzb.½±Àø DESC£¬rsb.»ù±¾¹¤×Ê DESC INTO TABLE cx £¨12£©SELECT rsb.ÐÕÃû, bmdm.²¿ÃÅÃû³Æ,zz.Ôö×ÊÈÕÆÚ,zz.Ôö×Ê FROM rsb,bmdm,zz; WHERE rsb.²¿ÃÅ´úÂë= bmdm.´úÂë .AND. rsb.±àºÅ=zz.±àºÅ;
ORDER BY 1 TO FILE wb £¨¶þ£©ÀûÓòéѯÏòµ¼´´½¨²éѯ 1£®ÊµÑéÒªÇó
´Óglk.dbcÖвéѯÿλְ¹¤µÄ±£ÏÕ½ð¶î£¬²¢°´±£ÏÕ×ֶεĽµÐòÅÅÐòÊä³öÐÕÃû¡¢ÐԱ𡢳öÉúÈÕÆÚ¡¢»ù±¾¹¤×ʺͱ£ÏÕ5¸ö×Ö¶ÎÄÚÈÝ£¬ÒÔÎļþÃûcx1.qpr±£´æ²éѯÉèÖá£
2£®²Ù×÷²½Öè
²½Öè1£ºÆô¶¯¡°²éѯÏòµ¼¡±¡£µ¥»÷¡°Îļþ¡±¡ú¡°Ð½¨¡±¡ú¡°²éѯ¡±¡ú¡°Ïòµ¼¡±£¬ÔÚ¡°Ïò
35
¡¶Visual FoxProÊý¾Ý¿â³ÌÐòÉè¼Æ¡·ÊµÑéÖ¸µ¼Êé
µ¼Ñ¡È¡¡±¶Ô»°¿òÖеÄѡȡҪʹÓõÄÏòµ¼ÁбíÖÐÑ¡È¡¡°²éѯÏòµ¼¡±£¬µ¥»÷¡°È·¶¨¡±°´Å¥£¬Æô¶¯²éѯÏòµ¼¡£
²½Öè2£ºÔÚ¡°²éѯÏòµ¼¡±¶Ô»°¿òµÄ¡°²½Öè1-×Ö¶ÎÑ¡È¡¡±¡£Ñ¡È¡±írsb.dbfºÍgzb.dbf£¬½«ÐÕÃû¡¢ÐԱ𡢳öÉúÈÕÆÚ¡¢»ù±¾¹¤×ʺͱ£ÏÕ5¸ö×ֶδӡ°¿ÉÓÃ×ֶΡ±ÁÐÌí¼Óµ½¡°Ñ¡¶¨×ֶΡ±ÁС£µ¥»÷¡°ÏÂÒ»²½¡±¡£
²½Öè3£º½øÈë¡°²½Öè2-Ϊ±í½¨Á¢¹Øϵ¡±¡£Ñ¡Ôñrsb.±àºÅºÍgzb.±àºÅ£¬µ¥»÷¡°Ìí¼Ó¡±°´Å¥£¬½¨Á¢Á½±íµÄ¹ØÁª¡£µ¥»÷¡°ÏÂÒ»²½¡±¡£
²½Öè4£º½øÈë¡°²½Öè2a-×Ö¶ÎÑ¡È¡¡°¡£Ñ¡Ôñ½ö°üº¬Æ¥ÅäµÄÐС±µ¥Ñ¡°´Å¥£¬µ¥»÷¡°ÏÂÒ»²½¡±¡£
²½Öè5£º½øÈë¡°²½Öè3-Ñ¡È¡×ֶΡ±¡£´Ë´¦¸ù¾ÝÌâÒâÎÞÉèÖ㬵¥»÷¡°ÏÂÒ»²½¡±¡£ ²½Öè6£º½øÈë¡°²½Öè4-¼Ç¼ÅÅÐò¡±¡£½«¡°gzb.±£ÏÕ¡±×ֶδӡ°¿ÉÓÃ×ֶΡ±ÁÐÌí¼Óµ½¡°Ñ¡¶¨×ֶΡ±ÁУ¬²¢Ñ¡Ôñ¡°½µÐò¡±µ¥Ñ¡°´Å¥£¬µ¥»÷¡°ÏÂÒ»²½¡±¡£
²½Öè7£º½øÈë¡°²½Öè4a-ÏÞÖƼǼ¡±¡£Ê¹ÓÃĬÈÏÉèÖ㬵¥»÷¡°ÏÂÒ»²½¡±¡£
²½Öè8£º½øÈë¡°²½Öè5-Íê³É¡±¡£µ¥»÷¡°Ô¤ÀÀ¡±°´Å¥¿É¿´Ô¤ÀÀЧ¹û£¬µ¥»÷¡°Íê³É¡±°´Å¥£¬ÊäÈë±£´æÎļþÃûcx1.qpr¡£
²½Öè9£ºÔËÐвéѯ£ºÔÚÃüÁî´°¿ÚÖÐÊäÈëÃüÁîDO cx1.qpr ¡£ ²éѯ½á¹ûÈçͼ8-1Ëùʾ£º
ͼ8-1ÔËÐвéѯ½á¹ûÏÔʾ
д³öÉÏÊö²Ù×÷ÏàÓ¦µÄSQL-SELECT ÃüÁ ¡£ £¨Èý£©ÀûÓòéѯÉè¼ÆÆ÷½¨Á¢²éѯ 1£®ÊµÑéÒªÇó
´Óglk.dbc²éѯְ³ÆΪ¸±½ÌÊÚ»ò½ÌÊÚ£¬»òÕß1990ÄêÒÔÇ°²Î¼Ó¹¤×÷µÄÖ°¹¤µÄÐÕÃû¡¢Ö°³Æ¡¢¹¤×÷ÈÕÆÚ¡¢ËùÔÚ²¿ÃÅÃû³ÆºÍ»ù±¾¹¤×ʵÄÄÚÈÝ£¬Êä³ö°´»ù±¾¹¤×ʵĽµÐòÅÅÁУ¬²¢ÒÔÎļþ
36