Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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
£¬Ê


Ïà¹ØÎĵµ£º

MySQL 5.5 m2 VS MS Sql Server 2000 SE BenchMark

×÷Õߣº°½Ê¿Î°
·þÎñÆ÷£ºIBM X346
CPU:Intel Xeon 3.0 *4
Äڴ棺2GB
Ó²ÅÌ£ºRAID5
OS£ºwin2003 SE
Ò»¡¢MySQL 5.5 M2
MySQL ĬÈÏÒýÇæInnoDB£¬ÓÅ»¯Ç°ºó¼¸ºõÎÞ²î±ð
¶þ¡¢SQL SERVER 2000 SE
     ´ÓÕâû´Î²âÊÔ¿´£¬MysqlÔÚÊÂÎñÐÔÄܱíÏÖ²»ÈçSQL SERVER¡£Í¬Ê±£¬Á½ÕßÔÚĬÈÏÇé¿ö£¬ÅúÁ¿Insert£¬Mysql±íÏ ......

SQL ³£Óô洢¹ý³Ì

³£Óô洢¹ý³Ì¼¯½õ,¶¼ÊÇһЩmssql³£ÓõÄһЩ£¬´ó¼Ò¿ÉÒÔ¸ù¾ÝÐèҪѡÔñʹÓá£
¡¡¡¡=================·ÖÒ³==========================
¡¡¡¡/*·ÖÒ³²éÕÒÊý¾Ý*/
¡¡¡¡CREATE PROCEDURE [dbo].[GetRecordSet]
¡¡¡¡@strSql varchar(8000),--²éѯsql,Èçselect * from [user]
¡¡¡¡@PageIndex int,--²éѯµ±Ò³ºÅ
¡¡¡¡@PageSize ......

¡¾×ªÔØ¡¿SQL Server ´æ´¢¹ý³ÌµÄ·ÖÒ³

°æÈ¨ÉùÃ÷£º×ªÔØÊ±ÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂԭʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://copyzhu.blogbus.com/logs/10168078.html
  À´Ô´£ºÐ¡ÕÅ.NET
 
½¨Á¢±í£º 
CREATE TABLE [TestTable] ( 
[ID] [int] IDENTITY (1, 1) NOT NULL , 
[FirstName ......

Pl/sql ±à³ÌÖ®case whenµÄÓ÷¨

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Ì ......

SQLÖÐEXISTSµÄÓ÷¨


±ÈÈçÔÚNorthwindÊý¾Ý¿âÖÐ  
  ÓÐÒ»¸ö²éѯΪ  
  SELECT   c.CustomerId,   CompanyName  
  from   Customers   c  
  WHERE   EXISTS(  
              SELECT   OrderID   from   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ