sql²éѯ
1¡¢²éѯÈýÃŹ¦¿Î¶¼ÔÚ80·ÖÒÔÉϵÄͬѧÐÕÃû(Ò»ÌõsqlÓï¾ä)
name kecheng fenshu
ÕÅÈý ÓïÎÄ 78
ÕÅÈý Êýѧ 81
ÕÅÈý ÎïÀí 89
ÀîËÄ ÓïÎÄ 86
ÀîËÄ Êýѧ 91
ÀîËÄ ÎïÀí 75
ÍõÎå ÓïÎÄ 81
ÍõÎå Êýѧ 90
ÍõÎå ÎïÀí 89
select distinct name from student a where not exists(select * from student where a.name=name and fenshu<80)
SELECT NAME from student GROUP BY name HAVING count(*)=count(case when fenshu>=80 then 1 else null end)
2¡¢Ñ§Éú±í ÈçÏÂ:
×Ô¶¯±àºÅ¡¡ ѧºÅ¡¡ ÐÕÃû ¿Î³Ì±àºÅ ¿Î³ÌÃû³Æ ·ÖÊý
1¡¡¡¡¡¡¡¡2005001¡¡ÕÅÈý¡¡0001¡¡¡¡¡¡Êýѧ¡¡¡¡69
2¡¡¡¡¡¡¡¡2005002¡¡ÀîËÄ¡¡0001¡¡¡¡¡¡Êýѧ¡¡¡¡89
3¡¡¡¡¡¡¡¡2005001¡¡ÕÅÈý¡¡0001¡¡¡¡¡¡Êýѧ¡¡¡¡69
ɾ³ý³ýÁË×Ô¶¯±àºÅ²»Í¬,ÆäËû¶¼ÏàͬµÄѧÉúÈßÓàÐÅÏ¢
delete tablename where ×Ô¶¯±àºÅ not in(select min(×Ô¶¯±àºÅ) from tablename group by ѧºÅ,ÐÕÃû,¿Î³Ì±àºÅ,¿Î³ÌÃû³Æ,·ÖÊý)
3. ±íA(µ¥Î»Ãû³Æ£¬µ¥Î»ÕʺÅ), ±íB(µ¥Î»±àºÅ£¬¸öÈËÕ˺Å)
Áгö¸÷µ¥Î»µÄÃû³Æ£¬Õ˺ţ¬ÒÔ¼°µ¥Î»µÄÈËÊý
select A.name, A.dwzh, isnull(Ct.Quantity,'0') as Quantity from A
left join
(select dwzh, count(*) as Quantity from B
group by dwzh) as Ct
on A.dwzh = Ct.dwzh
4¡¢border ,cellpadding, tdÖÐµÄ cellspacing,rowspanµÄ×÷Óã¿
cellpadding:µ¥Ôª¸ñÄÚÈÝÓëµ¥Ôª¸ñ±ß½çµÄ¾àÀë
5¡¢ÓÃjsд³ö¾¯¸æ¡¢È·ÈÏ¡¢ÐÅÏ¢ÊäÈë´°¿ÚÃüÁî?
6¡¢ÓÃjsд³öµ±ä¯ÀÀdefault.aspxÒ³Ãæʱºò£¬ÈçºÎÌøתµ½ÁíÍâÒ»Ò³£¿
Ïà¹ØÎĵµ£º
ÈëÃÅƪ
////////////////////////////////////////////
% : ±íʾ0~n¸öÈÎÒâ×Ö·û
_ : ±íʾµ¥¸öÈÎÒâ×Ö·û
[] :±íʾÔÚÀ¨ºÅÀïÁгöµÄÈÎÒâ×Ö·û
[^]:±íʾÈÎÒâ¸öûÓÐÔÚÀ¨ºÅÖÐÁгöµÄ×Ö·û
***********************
ϵͳÊý¾Ý¿â
MASTERÊý¾Ý¿â:
......
¡¡¡¡
¡¡¡¡¡ô¾¡Á¿²»ÒªÔÚwhereÖаüº¬×Ó²éѯ;
¡¡¡¡¹ØÓÚʱ¼äµÄ²éѯ£¬¾¡Á¿²»ÒªÐ´³É£ºwhere to_char(dif_date,'yyyy-mm-dd')=to_char('2007-07-01','yyyy-mm-dd');
¡¡¡¡¡ôÔÚ¹ýÂËÌõ¼þÖУ¬¿ÉÒÔ¹ýÂ˵ô×î´óÊýÁ¿¼Ç¼µÄÌõ¼þ±ØÐë·ÅÔÚwhere×Ó¾äµÄĩβ;
¡¡¡¡from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í£¬driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖа ......
Ìá¸ßSQLÖ´ÐÐЧÂʵļ¸µã½¨Òé:
¡¡¡¡¡ô¾¡Á¿²»ÒªÔÚwhereÖаüº¬×Ó²éѯ;
¡¡¡¡¹ØÓÚʱ¼äµÄ²éѯ£¬¾¡Á¿²»ÒªÐ´³É£ºwhere to_char(dif_date,'yyyy-mm-dd')=to_char('2007-07-01','yyyy-mm-dd');
¡¡¡¡¡ôÔÚ¹ýÂËÌõ¼þÖУ¬¿ÉÒÔ¹ýÂ˵ô×î´óÊýÁ¿¼Ç¼µÄÌõ¼þ±ØÐë·ÅÔÚwhere×Ó¾äµÄĩβ;
¡¡¡¡from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í£¬driving table)½«±»× ......
from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í£¬driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£
¡¡¡¡Ìá¸ßSQLÖ´ÐÐЧÂʵļ¸µã½¨Òé:
¡¡¡¡¡ô¾¡Á¿²»ÒªÔÚwhereÖаüº¬×Ó²éѯ;
¡¡¡¡¹ØÓÚʱ¼äµÄ²éѯ£¬¾¡Á¿²»ÒªÐ´³É£ºwhere to_char(dif_date,'yyyy-mm-dd')=to_char('2007-07-01',' ......
1¡£Sysdate µ±Ç°ÈÕÆÚºÍʱ¼ä
SQL> Select sysdate from dual;
SYSDATE
----------
21-6ÔÂ -05
2¡£Last_day ±¾ÔÂ×îºóÒ»Ìì
SQL> Select last_day(sysdate) from dual;
LAST_DAY(S
----------
30-6ÔÂ -05
3¡£Add_months(d,n) µ±Ç°ÈÕÆÚdºóÍÆn¸öÔÂ
ÓÃÓÚ´ÓÒ»¸öÈÕÆÚÖµÔö¼Ó»ò¼õÉÙһЩÔ·Ý
date_value:=add_mont ......