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

¸ü¶à¼òµ¥¶øʵÓÃµÄ DB2 SQL Óï¾ä


----start
ÎÊÌ⣺²é¿´DB2 °æ±¾---SELECT * from SYSIBM.SYSVERSIONS
ÎÊÌ⣺²é¿´ÏµÍ³ÖÐÓÐÄÄЩ±íÒÔ¼°ÕâЩ±íµÄ¸ÅÒªÐÅÏ¢£ºSELECT * from SYSCAT.TABLES
ÎÊÌ⣺²é¿´Ä³¸ö±íÓÐÄÄЩÁÐÒÔ¼°ÕâЩÁеĸÅÒªÐÅÏ¢£ºSELECT * from SYSCAT.COLUMNS WHERE  TABNAME=<YOUR_TABLE_NAME>
---´ýÐøδÍê
---¸ü¶à²Î¼û£ºDB2 SQL ¾«Òª
----ÉùÃ÷£º×ªÔØÇë×¢Ã÷³ö´¦¡£
----last update at 2009.9.25
----write by wave at 2009.9.25
----end


Ïà¹ØÎĵµ£º

NHibernateÖ´ÐÐԭʼSQL´úÂëµÄ·½·¨Ð¡½á

ÔÚʹÓÃNHibernate¹ý³ÌÖо­³£»áʹÓõ½¸´ÔÓµÄsql²éѯ£¬µ«ÊÇʹÓÃhqlÓֱȽÏÂé·³µÄÇé¿öÏ£¬ÎÒÃÇÍùÍù¶¼»áÏëµ½²ÉÓÃԭʼµÄsqlÀ´Ö´ÐС£µ«ÊÇÈçºÎÀûÓÃNHibernateÀ´Ö´ÐÐsqlÄØ£¿ÎÊÌâÀ´ÁË£¬ÔÚNHibernateÖÐÒ²ÓÐAdoTemplateµÄ·½·¨¿ÉÒÔÖ´ÐÐsqlµÄ£¬µ«ÊÇÕâÀïÒª½éÉܵÄÊÇÁíÍâÒ»ÖÖ·½·¨£ºCreateSQLQuery¡£ÒÔϲ¿·ÖÀý×ÓÔ´×ÔÓÚÍøÂç¡£
ʵÀýÒ»£¨Ô´×ÔÓÚ ......

SQL·ÖÒ³ ÀûÓÃID´óÓÚ¶àÉÙºÍSELECT TOP·ÖÒ³

Óï¾äÐÎʽ£º¡¡ SELECTTOP10*
fromTestTable
WHERE(ID>
¡¡¡¡¡¡¡¡¡¡(SELECTMAX(id)
¡¡¡¡¡¡¡¡from(SELECTTOP20id
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡fromTestTable
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ORDERBYid)AST))
ORDERBYID
SELECTTOPÒ³´óС*
fromTestTable
WHERE(ID>
¡¡¡¡¡¡¡¡¡¡(SELECTMAX(id)
¡¡¡¡¡¡¡¡from(SELECTTOPÒ³´óС*Ò³Êýid
¡¡¡¡¡ ......

sql È¥¿Õ¸ñÓëÁ¬½ÓÌØÊâ×Ö·û

ÔÚ·Ö×éÅÅÐò¹ý³ÌÖÐÐèҪн¨ÅÅÐòÁУ¬°´Ìõ¼þ:(ÎïÁÏ·ÖÀà+¿Í»§Ãû³Æ) ½øÐзÖ×é»ã×Ü È»ºó¾Í¸ù¾Ý¸ÃÌõ¼þ½øÐÐÅÅÐò
1.ÐèҪƴ´ÕÁ½ÁÐ ×÷ΪÅÅÐòÁÐ,ÈçÐè¼ÓÈëÌØÊâ×Ö·û.¾Í»á±¨´í.
   ÒòΪ±¾Éí¸Ä×ֶξÍÊÇvarcharÀàÐÍ ÐèÒª½«charÀàÐÍ'_' ת»»³Évarchar
2.Æ´´Õ¹ý³ÌÖÐÓпոñÐèҪȥ¿Õ¸ñ
 e.g£ºselect (trim(ÎïÁÏ·ÖÀà)+to_char( ......

javaʱ¼äº¯Êý£¬ÒÔ¼° sql ʱ¼ä·¶Î§²éÕÒ ´úÂë

 String keyword = request.getParameter("keyword");
   String timeRange = request.getParameter("timeRange");
   String type = request.getParameter("type");
  
   StringBuffer sql = new StringBuffer();
   sql.append("use webstation_leadall s ......

ÈçºÎÔÚSQLÖÐÆôÓÃÈ«ÎļìË÷¹¦ÄÜ

ÈçºÎÔÚSQLÖÐÆôÓÃÈ«ÎļìË÷¹¦ÄÜ£¿
¡¡¡¡--------------------------------------------------------------------------------
¡¡¡¡È«ÎÄË÷ÒýµÄÒ»¸öÀý×Ó£¬ÔÚ²éѯ·ÖÎöÆ÷ÖÐʹÓãº
¡¡¡¡use pubs
¡¡¡¡go
¡¡¡¡--´ò¿ªÊý¾Ý¿âÈ«ÎÄË÷ÒýµÄÖ§³Ö
¡¡¡¡execute sp_fulltext_database 'enable'
¡¡¡¡go
¡¡¡¡--½¨Á¢È«ÎÄĿ¼ft_titles
¡¡¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ