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

sqlÓï¾äÓÅ»¯Ô­Ôò

1.¶àwhere£¬ÉÙhaving
whereÓÃÀ´¹ýÂËÐУ¬havingÓÃÀ´¹ýÂË×é
2.¶àunion all£¬ÉÙunion
unionɾ³ýÁËÖظ´µÄÐУ¬Òò´Ë»¨·ÑÁËһЩʱ¼ä
3.¶àExists£¬ÉÙin
ExistsÖ»¼ì²é´æÔÚÐÔ£¬ÐÔÄܱÈinÇ¿ºÜ¶à£¬ÓÐЩÅóÓѲ»»áÓÃExists£¬¾Í¾Ù¸öÀý×Ó
Àý£¬ÏëÒªµÃµ½Óе绰ºÅÂëµÄÈ˵Ļù±¾ÐÅÏ¢£¬table2ÓÐÈßÓàÐÅÏ¢
select * from table1;--(id,name,age)
select * from table2;--(id,phone)
in£º
select * from table1 t1 where t1.id in (select t2.id from table2 t2 where t1.id=t2.id);
Exists£º
select * from table1 t1 where Exists (select 1 from table2 t2 where t1.id=t2.id);
4.ʹÓð󶨱äÁ¿
OracleÊý¾Ý¿âÈí¼þ»á»º´æÒѾ­Ö´ÐеÄsqlÓï¾ä£¬¸´ÓøÃÓï¾ä¿ÉÒÔ¼õÉÙÖ´ÐÐʱ¼ä¡£
¸´ÓÃÊÇÓÐÌõ¼þµÄ£¬sqlÓï¾ä±ØÐëÏàͬ
ÎÊ£ºÔõÑùË㲻ͬ£¿
´ð£ºËæ±ãʲô²»Í¬¶¼Ë㲻ͬ£¬²»¹Üʲô¿Õ¸ñ°¡£¬´óСдʲôµÄ£¬¶¼ÊDz»Í¬µÄ
ÏëÒª¸´ÓÃÓï¾ä£¬½¨ÒéʹÓÃPreparedStatement
½«Óï¾äд³ÉÈçÏÂÐÎʽ£º
insert into XXX(pk_id,column1) values(?,?);
update XXX set column1=? where pk_id=?;
delete from XXX where pk_id=?;
select pk_id,column1 from XXX where pk_id=?;
5.ÉÙÓÃ*
ºÜ¶àÅóÓѺÜϲ»¶ÓÃ*£¬±ÈÈ磺select * from XXX;
Ò»°ãÀ´Ëµ£¬²¢²»ÐèÒªËùÓеÄÊý¾Ý£¬Ö»ÐèҪһЩ£¬ÓеĽö½öÐèÒª1¸ö2¸ö£¬
ÄÃ5WµÄÊý¾ÝÁ¿£¬10¸öÊôÐÔÀ´²âÊÔ:
(ÕâÀïµÄʱ¼äÖ¸µÄÊÇPL/SQL DeveloperÏÔʾËùÓÐÊý¾ÝµÄʱ¼ä)
ʹÓÃselect * from XXX;ƽ¾ùÐèÒª20Ã룬
ʹÓÃselect column1,column2 from XXX;ƽ¾ùÐèÒª12Ãë
(ÎҵĻú×Ó²»ÊǺܺᣡ£¡£)
¶ÔÓÚ¿ª·¢À´Ëµ£¬ÕâÒ»ÌõÊǸöÔÖÄÑ£¬ÖªµÀÊÇÒ»»ØÊ£¬×ö¾ÍÊÇÁíÒ»»ØÊÂÁË
6.·ÖÒ³sql
Ò»°ãµÄ·ÖÒ³sqlÈçÏÂËùʾ£º
sql1:select * from (select t.*,rownum rn from XXX t)where rn>0 and rn <10;
sql2:select * from (select t.*,rownum rn from XXX t where rownum <10)where rn>0;
Õ§¿´Ò»ÏÂûʲôÇø±ð£¬Êµ¼ÊÉÏÇø±ðºÜ´ó...125ÍòÌõÊý¾Ý²âÊÔ£¬
sql1ƽ¾ùÐèÒª1.25Ãë(Õ¦Õâô׼ÄØ£¿ )
sql2ƽ¾ùÐèÒª... 0.07Ãë
Ô­ÒòÔÚÓÚ£¬×Ó²éѯÖУ¬sql2ÅųýÁË10ÒÔÍâµÄËùÓÐÊý¾Ý
µ±È»ÁË£¬Èç¹û²éѯ×îºó10Ìõ£¬ÄÇЧÂÊÊÇÒ»ÑùµÄ
7.ÄÜÓÃÒ»¾äsql£¬Ç§Íò±ðÓÃ2¾äsql
²»½âÊÍ


Ïà¹ØÎĵµ£º

SQLÊý¾Ý¿âÁ¬½ÓÓï¾ä

Ò»°ãµÄÔ¶³Ì·ÃÎʵÄд³ÉÕâÑù£º
Data Source=IP;Initial Catalog=Êý¾Ý¿âÃû;UserID=Óû§Ãû;Password=ÃÜÂë
±¾µØ·ÃÎʵÄд³ÉÕâÑù£º
Data Source=(local);Initial Catalog=Êý¾Ý¿âÃû;UserID=Óû§Ãû;Password=ÃÜÂë
Èç¹ûÊDZ¾µØµÄ£¬Í¨¹ýwindows×é¼þÑéÖ¤µÄ£¨Ò²¾ÍÊÇûÓÐÓû§Ãû£¬ÃÜÂëµÄ£©Ð´³ÉÕâÑù£º
Data Source=(local);Initial Cata ......

SybaseµÄSQL Anywhere for BlackBerry

UltraLite®J£ºBlackBerryÉÏÔËÐеÄСÊý¾Ý¿âºÍͬ²½ÒýÇæ
MobiLink £ºÔËÐÐÔÚ·þÎñÆ÷ÉÏÊý¾Ý¿âͬ²½·þÎñÆ÷£¬¿ÉÒÔ°ÑÉ豸ÉϵÄÊý¾Ýͬ²½µ½ºǫ́µÄ¡£°üº¬ÔÚSQL Anywhere 11ÀïÃæ¡£
SQL Anywhere ÊÇÒµÄÚÁìÏȵÄÒƶ¯ºÍǶÈëʽÊý¾Ý¿â£¬ÌṩÊý¾Ý¹ÜÀíºÍ½»»»¼¼Êõ£¬ÎªÒ»Ïß»·¾³ÖеÄÓ¦ÓóÌÐòÌṩ֧³Ö¡£
SQL Anywhere רΪ²»¾ß±¸ÏÖ³¡ IT Ö§³Ö¡¢Ô ......

ÓÃTSQL°ÑAccessµÄ±íµ¼Èëµ½Ô¶³ÌSql Server

ÓÃTSQL°ÑAccessµÄ±íµ¼Èëµ½Ô¶³ÌSql Server£º
°Ñaccess µÄ.mdbÀït_itemList ±íµÄÊý¾Ý²åÈëµ½Ô¶³ÌSqlServerµÄt_itemL1111111±íÀï¡£
SELECT  top 10 *  INTO  t_itemL1111111 IN [ODBC] 
[ODBC;Driver=SQL Server; UID=jyb;PWD=jyb;Server=10.1.18.49;DataBase=ËùÓкϲ¢;]
    &nb ......

sqlµ÷ÓÅÖ® Ñ°ÕÒÎÒÃÇ×î¸ÐÐËȤµÄÓï¾ä

Tuning an Application / Reducing Load
If your whole application is performing suboptimally, or if you are attempting to
reduce the overall CPU or I/O load on the database server, then identifying
resource-intensive SQL involves the following steps:
1. Determine which period in the day you would ......

³£ÓõÄWORDPRESS µÄSQLÓï¾ä


ÏÂÃæËùÓеÄSQLÓï¾ä¶¼ÊÇÕë¶Ôǰ׺Ϊwp_µÄ±í£¬Èç¹ûÄãµÄ±íǰ׺²»ÊÇwp_£¬Çë×öÏàÓ¦µÄÐÞ¸Ä
1.¸ü¸Äwordpress°²×°ºÍÊ×Ò³µØÖ·
Èç¹ûÄã¸ü»»ÓòÃû»òÕß°ÑwordpressµÄ°²×°Ä¿Â¼½øÐÐÁ˱䶯¾ÍÐèÒª½øÐÐÐ޸ģ¬
UPDATE wp_options SET option_value = replace(option_value, ‘¾ÉÍøÖ·’, ‘ÐÂÍøÖ·’) WHERE option_name ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ