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

sql ·ÖÒ³¼¼Êõ

·ÖÒ³Óï¾ä
sqlserver ·½°¸1: select top 10 * from t where id not in(select top 30 id from t order by id) order by id
·½°¸2£º select top 10 * from t where id in (select top 40 id from t order by id)oder by id desc
mysql: select * from t order by id limit 30,10
oracle: select * from (select rownum r * from t where r<=40)where r>30
·ÖÒ³¼¼Êõ:
mysql: sql ="select * from articles limit" +(pageNo-1)*pageSize + "," +pageSize;
 oracle: sql="select * from " + "(select rownum r,* from" +"(select * from articles order by posttime desc)" + "where rownum <= " +pageNo *pageSize")tmp" + "where r>" +(pageNo-1)*pageSize";
sqlserver:sql = "select top 10 * from id not id(select top " + (pageNo-1)*pageSize + "id from articles)"
 DataSource ds = new InitialContext().lookup(jndiurl); Connection cn = ds.getConnection(); //"select * from user where id=?" --->binary directive PreparedStatement pstmt = cn.prepareSatement(sql); ResultSet rs = pstmt.executeQuery() while(rs.next()) { out.println(rs.getString(1)); }


Ïà¹ØÎĵµ£º

SQLSERVER SQLÐÔÄÜÓÅ»¯

1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......

ʹÓÃSQLServerÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾ä

Èç¹ûÄã¾­³£Óöµ½ÏÂÃæµÄÎÊÌ⣬Äã¾ÍÒª¿¼ÂÇʹÓÃSQL ServerµÄÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾äÁË£º
SQL³õѧÕß¡£
¾­³£Íü¼Ç³£ÓõÄDML»òÊÇDDL SQL Óï¾ä¡£
ÔÚ¶àÈË¿ª·¢Î¬»¤µÄSQLÖУ¬Ã¿¸öÈ˶¼ÓÐ×Ô¼ºµÄSQLÏ°¹ß£¬Ã»ÓÐÒ»Ì×ͳһµÄ¹æ·¶¡£
ÔÚSQL Server Management StudioÖУ¬ÒѾ­¸ø´ó¼ÒÌṩÁ˺ܶೣÓõÄÏÖ³ÉSQL¹æ·¶Ä£°å¡£
SQL Server Management ......

ͨ¹ýMsSqlDump¹¤¾ßÉú³Ésql½Å±¾²¢µ¼Èë

µ¼Èë·½·¨£ºÍ¨¹ýMsSqlDump¹¤¾ßÉú³Ésql½Å±¾²¢µ¼Èë
µ¼ÈëMSSQLÊý¾Ý¿âµÄµÚÈýÖÖ·½·¨£¬ÊÇͨ¹ýµÚÈý·½MsSqlDump¹¤¾ßÉú³Ésql²¢µ¼Èë¡£
ÊÊÓ÷¶Î§£ºÃ»Óд´½¨Êý¾Ý¿âµÄsql½Å±¾£¬µ«ÊÇÓÐÕýÔÚÔËÐеÄÊý¾Ý¿â
ÕâÖÖ±¸·Ý·½·¨£¬ÐèÒª½èÖúµÚÈý·½¹¤¾ß£ºMsSqlDump ¡£
Ê×ÏÈÔÚ±¾µØ¿ª·¢»·¾³ÉÏ£¬´ò¿ªMSSQLÆóÒµ¹ÜÀíÆ÷£¬ÕÒµ½ÕýÔÚÔËÐеÄÊý¾Ý¿â¡£ÀýÈçÒª¶Ô±¾ ......

sqlÀàÐÍת»»º¯ÊýcastºÍconvert

¼ò½é£º
        Êý¾ÝÀàÐÍת»»¿ÉÒÔͨ¹ýCAST()ºÍCONVERT()º¯ÊýÀ´ÊµÏÖ¡£´ó¶àÊýÇé¿öÏ£¬ÕâÁ½¸öº¯ÊýÊÇÖصþµÄ£¬ËüÃÇ·´Ó³ÁËSQLÓïÑÔµÄÑÝ»¯ÀúÊ·¡£ÕâÁ½¸öº¯ÊýµÄ¹¦ÄÜÏàËÆ£¬²»¹ýËüÃǵÄÓï·¨²»Í¬¡£ËäÈ»²¢·ÇËùÓÐÀàÐ͵ÄÖµ¶¼ÄÜת±äΪÆäËûÊý¾ÝÀàÐÍ£¬µ«×ܵÄÀ´Ëµ£¬ÈκοÉÒÔת»»µÄÖµ¶¼¿ÉÒÔÓüòµ¥µÄº¯ÊýʵÏÖ× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ