£¨2£©ÇóËùÓÐѧÉúµÄѧϰ³É¼¨£¬²¢ÁгöÐÕÃû¡¢ÐԱ𡢿γÌÃû¡¢Ñ§Ê±ÊýºÍ³É¼¨£» £¨3£©ÏÔʾËùÓÐÑ¡ÐÞ¡°C ÓïÑÔ¡±µÄͬѧÐÅÏ¢¡£ £¨4£©ÏÔʾ×ֱܷȡ°Ç®ÄÜ¡±Í¬Ñ§¸ßµÄѧÉú £¨5£©ÏÔʾ³É¼¨ÎªÇ° 3 ÃûµÄͬѧµÄÐÕÃû¡¢ÐԱ𡢿γÌÃû¡¢ºÍ³É¼¨
Ï°Ìâ 4 ²Î¿¼½â´ð
Ò»¡¢Ñ¡ÔñÌâ
1~5£ºCADAD 6~10£ºDBBAD 11~15£ºCAABB 16~20£ºBCCCA 21~25£ºBDCBA
¶þ¡¢Ìî¿ÕÌâ
1£®²éѯÏòµ¼¡¢²éѯÉè¼ÆÆ÷¡¢SQL-SELECT ÃüÁî 2£®±¾µØÊÓͼ¡¢Ô¶³ÌÊÓͼ
3£®ÄÚ²¿Áª½Ó¡¢×óÁª½Ó¡¢ÓÒÁª½Ó¡¢ÍêÈ«Áª½Ó 4£®ä¯ÀÀ¡¢ÁÙʱ±í¡¢±í¡¢7 5£®²»ÄÜ¡¢ÄÜ£¨¿ÉÒÔ£©
6£®×ÔÓÉ±í¡¢Êý¾Ý¿â±í¡¢ÊÓͼ
7£®ADD¡¢DROP¡¢RENAME¡¢ALTER 8£®DISTINCT 9£®ÉýÐò¡¢½µÐò 10£®GROUP BY Èý¡¢²Ù×÷Ìâ
1£®CREATE TABLE XS(XH C(6),XM C(8),XB C(2),NL N(2))
ÔÙ½»»¥»òÓà SQL ·½Ê½ÌîдÄÚÈÝ CREATE TABLE KC(KCH C(2),KCM C(16),XSS N(3)) ÔÙ½»»¥»òÓà SQL ·½Ê½ÌîдÄÚÈÝ CREATE TABLE CJ(XH C(6),KCH C(2),CJ N(3)) ÔÙ½»»¥»òÓà SQL ·½Ê½ÌîдÄÚÈÝ
2£®£¨1£©SELECT * FROM xs WHERE XB=\Å®\
£¨2£©SELECT Xs.xm AS ÐÕÃû, Xs.xb AS ÐÔ±ð, Kc.kcm AS ¿Î³ÌÃû, Kc.xss AS ѧʱÊý, Cj.cj AS ³É¼¨;
FROM xs INNER JOIN cj; INNER JOIN kc ;
ON Cj.kch = Kc.kch ; ON Xs.xh = Cj.xh
»ò
SELECT Xs.xm AS ÐÕÃû, Xs.xb AS ÐÔ±ð, Kc.kcm AS ¿Î³ÌÃû, Kc.xss AS ѧʱÊý,
µÚ¶þ²¿·Ö ¡¶Visual FoxPro ³ÌÐòÉè¼Æ£¨µÚ¶þ°æ£©¡·¸´Ï°ÌáÒªÓëѧϰָµ¼¡¢Ï°Ìâ¼°²Î¿¼½â´ð 115
116 Visual FoxPro ³ÌÐòÉè¼ÆʵѵÓ뿼ÊÔÖ¸µ¼£¨µÚ¶þ°æ£©
Cj.cj AS ³É¼¨ FROM xs,cj,kc Where Cj.kch = Kc.kch and Xs.xh = Cj.xh £¨3£©SELECT Xs.xh AS ѧºÅ, Xs.xm AS ÐÕÃû, Xs.xb AS ÐÔ±ð, Xs.nl AS ÄêÁä;
FROM xs INNER JOIN cj; INNER JOIN kc ;
ON Cj.kch = Kc.kch ; ON Xs.xh = Cj.xh;
WHERE Kc.kcm = \ÓïÑÔ\»ò
SELECT Xs.xh AS ѧºÅ, Xs.xm AS ÐÕÃû, Xs.xb AS ÐÔ±ð, Xs.nl AS ÄêÁä;
FROM xs,cj,kc Where Cj.kch = Kc.kch and Xs.xh = Cj.xh and Kc.kcm = \ÓïÑÔ\ £¨4£©·Ö²½¼ÆË㣺
1£©ÏÈÇó³ö¡°Ç®ÄÜ¡±Í¬Ñ§µÄ×Ü·Ö¡£
SELECT sum( Cj.cj) as ×Ü·Ö; FROM xs INNER JOIN cj ; ON Xs.xh = Cj.xh;
WHERE Xs.xm = \Ç®ÄÜ\&&²úÉúº¬ÓС°Ç®ÄÜ¡±×Ü·ÖµÄÁÙʱ±í 2£©ZF=×Ü·Ö &&½«¡°×Ü·Ö¡±È¡µ½±äÁ¿Öб¸Óà 3£©SELECT Xs.xh, Xs.xm, sum( Cj.cj) as ×Ü·Ö;
FROM xs INNER JOIN cj ; ON Xs.xh = Cj.xh; GROUP BY Xs.xh; HAVING ×Ü·Ö> zf &&ÕÒµ½×ֱܷȡ°Ç®ÄÜ¡±Í¬Ñ§¸ßµÄѧÉú
£¨5£©SELECT Xs.xm AS ÐÕÃû, Xs.xb AS ÐÔ±ð, Kc.kcm AS ¿Î³ÌÃû, Cj.cj AS ³É¼¨;
FROM xs INNER JOIN cj; INNER JOIN kc ;
ON Cj.kch = Kc.kch ; ON Xs.xh = Cj.xh;
ORDER BY CJ.cj DESC TOP 3 »ò
SELECT Xs.xm AS ÐÕÃû, Xs.xb AS ÐÔ±ð, Kc.kcm AS ¿Î³ÌÃû, Cj.cj AS ³É¼¨; FROM xs,cj,kc Where Cj.kch = Kc.kch and Xs.xh = Cj.xh ORDER BY CJ.cj DESC TOP 3
2.5 ½á¹¹»¯³ÌÐòÉè¼Æ
2.5.1 ¸´Ï°ÌáÒªÓëѧϰָµ¼
1£®³£ÓÃÃüÁî *£¬&& ?
×¢Êͱê¼Ç£¬*ÓÃÀ´¶ÔÕûÐнøÐÐ×¢ÊÍ£¬Ö»ÄÜλÓÚÐеĿªÊ¼ »»ÐÐÏÔʾ£¨´ÓеÄÒ»ÐпªÊ¼ÏÔʾºóÃæµÄÊý¾Ý£©
??
´Óµ±Ç°ÐпªÊ¼ÏÔʾÊý¾Ý
CLEAR Çå³ýÖ÷´°¿ÚÖеÄÄÚÈÝ RUN ÔÚÃüÁî´°¿ÚÖ´ÐÐ WINOWS Ó¦ÓóÌÐò run notepad.exe QUIT/RETURN/CANCEL ½áÊø Visual FoxPro Ó¦ÓóÌÐò»ò·µ»Øµ÷Óô¦ SET BELL ON|OFF
SET CENTURY ON|OFF
ÊÀ¼Í¿ª¹Ø£¨ÊÇ·ñ²ÉÓÃËÄλµÄÄê·Ý£©
SET DATE TO YMD|MDY|DMY ÉèÖÃÈÕÆÚ¸ñʽ SET DEFAULT TO ÉèÖÃĬÈϹ¤×÷·¾¶ SET ESCAPE ON|OFF ÉèÖÃÊÇ·ñÓÉ ESC ¼üÖÕÖ¹³ÌÐòÔËÐÐ
SET SAFETY ON|OFF ÉèÖð²È«¿ª¹Ø£¨µ±ÒªÐ޸ĺÍÌæ»»Îļþʱ£¬ÊÇ·ñÓо¯¸æÐÅÏ¢£© SET SECONDS ON|OFF SET TALK ON|OFF ÉèÖà ´ò¿ªºÍ¹Ø±ÕÏÔʾÓû§ÃüÁîµÄÖмä½á¹û SET DECI TO n ÉèÖóÌÐòÖÐÊýÖµÊý¾ÝµÄСÊýλÊýΪ n λ WAIT ¡°Ìáʾ×Ö·û´®¡± WINDOWS ÓÃÀ´·µ»Ø³ÌÐò½á¹ûµÄ 2£®ÕÆÎÕÈýÖÖ»ù±¾¿ØÖƽṹ
£¨1£©Ë³Ðò½á¹¹¡£ ×î³£¼ûµÄ×î¸ù±¾µÄ³ÌÐò½á¹¹£¬°´³ÌÐò´úÂëÒÀ´ÎÖ´ÐС£ £¨2£©·ÖÖ§½á¹¹¡£
1£©IF Óï¾ä£¨Á½·ÖÖ§£¬ÀàËÆÓÚ IIF(Ìõ¼þ,±í´ïʽ 1,±í´ïʽ 2)º¯Êý£©
IF Ìõ¼þ [Óï¾ä×é 1] &&Ìõ¼þ³ÉÁ¢ÔòÖ´ÐÐ
ELSE
[Óï¾ä×é 2] &&Ìõ¼þ²»³ÉÁ¢ÔòÖ´ÐÐ
ENDIF
2£©CASE ½á¹¹(¶à·ÖÖ§)
DO CASE
CASE ±í´ïʽ 1
[Óï¾ä×é 1] CASE ±í´ïʽ 2
[Óï¾ä×é 2] ??
OTHERWISE
[Óï¾ä×é] ENDCASE
×¢Òâ
&&±íʾÆäËûÇé¿ö
ÔÚ DO CASE ÓëµÚÒ»¸ö CASE Ö®¼ä²»ÔÊÐí´æÔÚÆäËûÈκÎÓï¾ä¡£Ò»°ãÇé¿ö Ï£¬¶ÔÓÚÃüÁî°´Å¥×éºÍÑ¡Ïî°´Å¥×éµÄ±à³Ì¿ÉÒÔÓà CASE ½á¹¹¡£ £¨3£©Ñ»·½á¹¹¡£
1£©DO WHILE ¡ ENDDO£ºÊÊÓÃÓÚÑ»·´ÎÊýδ֪µÄÇé¿ö¡£
µÚ¶þ²¿·Ö ¡¶Visual FoxPro ³ÌÐòÉè¼Æ£¨µÚ¶þ°æ£©¡·¸´Ï°ÌáÒªÓëѧϰָµ¼¡¢Ï°Ìâ¼°²Î¿¼½â´ð 117
118 Visual FoxPro ³ÌÐòÉè¼ÆʵѵÓ뿼ÊÔÖ¸µ¼£¨µÚ¶þ°æ£©
DO WHILE Ìõ¼þ [Ñ»·Ö´ÐеÄÓï¾ä]
ENDDO
µ±Ìõ¼þΪÕæʱ£¬Ö´ÐÐÑ»·Ìå
EXIT£ºÖÕÖ¹Õû¸öÑ»·½á¹¹µÄÖ´ÐÐ
LOOP£ºÖÕÖ¹±¾´ÎÑ»·£¬Ö±½Ó½øÈëÏÂÒ»ÂÖµÄÑ»·
Ìø¹ý LOOP ºÍ ENDDO Ö®¼äµÄËùÓÐÓï¾ä£¬»Øµ½Ñ»·¿ªÊ¼Óï¾ä
¡¾Àý¡¿½«ÈÎÒâ×Ö·û£¨°üÀ¨ºº×Ö£©×é³ÉµÄ×Ö·û´®½øÐз´ÐòÏÔʾ¡£
STORE \£¬CC P=SPACE£¨0£©
DO WHILE LEN(C)>0
X=asc(left(c,1))
If x>127 && ASCII µÄ×î´óֵΪ 01111111£¨127£© I=2 &&ºº×Ö´¦Àí Else
I=1 &&×Öĸ´¦Àí Endif
P=left(c,i)+p C=substr(c,2*i-1) Enddo
?cc+\µÄ·´ÐòΪ\
&& c=right(c,len(c)-i)ʹÌõ¼þ²»¶ÏÏòÑ»·ÖÕÖ¹Ìõ¼þת»¯
2£©FOR¡ENDFOR£ºÓÃÀ´¶ÔÑ»·´ÎÊýÒÑÖªµÄÇé¿ö¡£
FOR I=e1 TO e2 STEP e3
[Ñ»·Ö´ÐеÄÓï¾ä]
ENDFOR|NEXT
e1 Ñ»·³õÖµ¡¢e2 Ñ»·ÖÕÖµ¡¢e3 ²½³¤£¨ÔöÁ¿£© e1
e1>e2 e3<0 ´Ó´óµ½Ð¡£¬Ã¿´Î¼õ
·½·¨ 2£º
nsum=0
nmul=1 for i=1 to 10 nmul=nmul*i
nsum=nsum+nmul next i ?nsum
nsum=0 for i=1 to 10
nmul=1 &&±£´æ½×³ËÖµ
&&ÍâÑ»·Ã¿Ö´ÐÐÒ»´Î£¬nmul ¶¼ÖØи³Öµ for j=1 to I &&ÒýÓÃÍâ²ãÑ»·±äÁ¿µÄÖµ nmul=nmul*j next j
&&ÒÔÉÏÄÚ²ãÑ»·ÓÃÀ´Çó I µÄ½×³Ë nsum=nsum+nmul next i ?nsum
3£©SCAN¡ENDSCAN£ºÓÃÀ´¶Ô±íÖеļǼ½øÐвÙ×÷£¬ÄÜ×Ô¶¯¸Ä±ä¼Ç¼ָÕëµÄλÖá£
SCAN [·¶Î§|FOR Ìõ¼þ|WHILE Ìõ¼þ]