Sql³£¼ûÃæÊÔÌâ ÊÜÓÃÁË
1.
ÓÃÒ»ÌõSQL
Óï¾ä ²éѯ³öÿÃſζ¼´óÓÚ80
·ÖµÄѧÉúÐÕÃû
name kecheng fenshu
ÕÅÈý
ÓïÎÄ 81
ÕÅÈý
Êýѧ 75
ÀîËÄ
ÓïÎÄ 76
ÀîËÄ
Êýѧ 90
ÍõÎå
ÓïÎÄ 81
ÍõÎå
Êýѧ 100
ÍõÎå
Ó¢Óï 90
A: select distinct
name from table where name not in (select distinct name from table where
fenshu<=80)
select name from table group by name having
min(fenshu)>80
2.
ѧÉú±í
ÈçÏÂ:
×Ô¶¯±àºÅ
ѧºÅ
ÐÕÃû ¿Î³Ì±àºÅ ¿Î³ÌÃû³Æ ·ÖÊý
1 2005001
ÕÅÈý 0001
Êýѧ
69
2 2005002
ÀîËÄ 0001
Êýѧ 89
3 2005001
ÕÅÈý 0001
Êýѧ 69
ɾ³ý³ýÁË×Ô¶¯±àºÅ²»Í¬,
ÆäËû¶¼ÏàͬµÄѧÉúÈßÓàÐÅÏ¢
A: delete tablename
where
×Ô¶¯±àºÅ not in(select min(
×Ô¶¯±àºÅ) from tablename group by
ѧºÅ,
ÐÕÃû,
¿Î³Ì±àºÅ,
¿Î³ÌÃû³Æ,
·ÖÊý)
3.
Ò»¸ö½Ð
team
µÄ±í£¬ÀïÃæÖ»ÓÐÒ»¸ö×Ö¶Îname,
Ò»¹²ÓÐ4
Ìõ¼Í¼£¬·Ö±ðÊÇa,b,c,d,
¶ÔÓ¦ËĸöÇò¶Ô£¬ÏÖÔÚËĸöÇò¶Ô½øÐбÈÈü£¬ÓÃÒ»Ìõsql
Óï¾äÏÔʾËùÓпÉÄܵıÈÈü×éºÏ.
ÄãÏÈ°´Äã×Ô¼ºµÄÏë·¨×öһϣ¬¿´½á¹ûÓÐÎÒµÄÕâ¸ö¼òµ¥Âð£¿
´ð£ºselect a.name, b.name
from team a, team b
where a.name <
b.name
4.
ÇëÓÃSQL
Óï¾äʵÏÖ£º´ÓTestDB
Êý¾Ý±íÖвéѯ³öËùÓÐÔ·ݵķ¢Éú¶î¶¼±È101
¿ÆÄ¿ÏàÓ¦Ô·ݵķ¢Éú¶î¸ßµÄ¿ÆÄ¿¡£Çë×¢Ò⣺TestDB
ÖÐÓкܶà¿ÆÄ¿£¬¶¼ÓÐ1
£12
Ô·ݵķ¢Éú¶î¡£
AccID
£º¿ÆÄ¿´úÂ룬Occmonth
£º·¢Éú¶îÔ·ݣ¬DebitOccur
£º·¢Éú¶î¡£
Êý¾Ý¿âÃû£ºJcyAudit
£¬Ê
Ïà¹ØÎĵµ£º
½ñÌ칤×÷時ºò輸Èë數據庫ÖÐÓÐÒ»條數據×Ö¶Î記錄ÊÇ"¿Í戶·ñ¾ö"
ʹÓÃ
select * from TelephoneStatusCategory where CategoryName like '%¿Í戶·ñ%'
select * from TelephoneStatusCategory where CategoryName like '%¿Í戶·ñ¾ö% ......
°æȨÉùÃ÷£º×ªÔØʱÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://copyzhu.blogbus.com/logs/10168078.html
À´Ô´£ºÐ¡ÕÅ.NET
½¨Á¢±í£º
CREATE TABLE [TestTable] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[FirstName ......
ISNULL
²éѯÊý¾ÝʱÈô×Ö¶ÎÖµÊÇNULL£¬ÔòʹÓÃʹÓÃÖ¸¶¨µÄÌæ»»ÖµÌæ»» NULL¡£
Óï·¨
ISNULL ( check_expression , replacement_value )
²ÎÊý
check_expression
½«±»¼ì²éÊÇ·ñΪ NULLµÄ±í´ïʽ¡£check_expression ¿ÉÒÔÊÇÈκÎÀàÐ͵ġ£
replacement_value
ÔÚ check_expression Ϊ NULLʱ½«·µ»ØµÄ±í´ïʽ¡£replacement_value ± ......
Õª×Ô£ºhttp://livenzhao.spaces.live.com/blog/cns!6E368BE9F6DDD872!595.entry
·PL/SQL DeveloperʹÓü¼ÇÉ
1¡¢PL/SQL Developer¼ÇסµÇ½ÃÜÂë
ÔÚʹÓÃPL/SQL Developerʱ£¬ÎªÁ˹¤×÷·½±ãÏ£ÍûPL/SQL Developer¼ÇסµÇ¼OracleµÄÓû§ÃûºÍÃÜÂ룻
ÉèÖ÷½·¨£ºPL/SQL Developer 7.1.2 ->tools->Preferences-> ......
Pl/sql ±à³ÌÖ®case whenµÄÓ÷¨£º£¨t3.LOCAL_BF_KND='111000' -- ±¾Ô»ù±¾ÔÂ×â·Ñ£©
select sum(t1.FAV_FEE) from bi_rw.FO_A_2FAV_M_G t1, bi_rw.D_BILLFEE_KND t3 where t1.BILLFEE_KND=t3.BILLFEE_KND(+) and t3.LOCAL_BF_KND='111000' --1310557.76
Èç¹û²»±ãÓÚ°ÑÌõ¼þt3.LOCAL_BF_KND='111000' дÔÚwhereÌ ......