³£ÓÃSQLÓï¾äÊÕ¼¯
1.ɾ³ý±í
select 'drop table ' || table_name || ' purge;'
from user_tables
where length(table_name) <= 4;
ɾ³ý´øÔ¼ÊøµÄ±í
Drop table ±íÃû cascade constraints;
2.²éѯview&ͬÒå´Ê
--˵Ã÷£º¿ÉÒÔ¸ù¾ÝÊÓͼµÄtext_lengthÖµÉ趨set long µÄ´óС
set long 2000;
select * from user_views where view_name='MY_VIEW_NAME';
select * from all_views where view_name='MY_VIEW_NAME';
select * from user_synonyms;
3.ÁÙʱ±í
create global temporary table xay_temp as select * from xay;
on commit preserve rows/on commit delete rows
ÔÚOracleÖУ¬¿ÉÒÔ´´½¨ÒÔÏÂÁ½ÖÖÁÙʱ±í:
a »á»°ÌØÓеÄÁÙʱ±í:
create global temporary table () on commit preserve rows;
»á»°Ö¸¶¨£¬µ±ÖжϻỰʱORACLE½«½Ø¶Ï±í
b ÊÂÎñÌØÓеÄÁÙʱ±í:
create global temporary table () on commit delete rows;
ÊÂÎñÖ¸¶¨,ÿ´ÎÌá½»ºóORACLE½«½Ø¶Ï±í£¨É¾³ýÈ«²¿ÐУ©
c ˵Ã÷
ÁÙʱ±íÖ»ÔÚµ±Ç°Á¬½ÓÄÚÓÐЧ
¡¡ ÁÙʱ±í²»½¨Á¢Ë÷Òý,ËùÒÔÈç¹ûÊý¾ÝÁ¿±È½Ï´ó»ò½øÐжà´Î²éѯʱ,²»ÍƼöʹÓÃ
¡¡ Êý¾Ý´¦Àí±È½Ï¸´ÔÓµÄʱºòʱ±í¿ì,·´Ö®ÊÓͼ¿ìµã
4.Ìî¼Ó×¢ÊÍ
comment on table ±íÃû is '×¢ÊÍ';
comment on column ±íÃû.ÁÐÃû is '×¢ÊÍ';
5. ROWNUM
°´É趨ÅÅÐòµÄÐеÄÐòºÅ
SELECT * from emp WHERE ROWNUM < 10 ;
6. ROWID
·µ»ØÐеÄÎïÀíµØÖ·
SELECT ROWID, ename from emp WHERE deptno = 20 ;
7. ¸´ÖƱ
Ïà¹ØÎĵµ£º
[MySQLÓÅ»¯] -- ÈçºÎÁ˽âSQLµÄÖ´ÐÐƵÂÊ
ʱ¼ä:2010-2-28À´Ô´:HaCMS¿ªÔ´ÉçÇø ×÷Õß:chuxu
MySQL ¿Í»§¶ËÁ¬½Ó³É¹¦ºó£¬Í¨¹ý show [session|global]status ÃüÁî ¿ÉÒÔÌṩ·þÎñÆ÷״̬ÐÅÏ¢£¬Ò²¿ÉÒÔÔÚ²Ù×÷ϵͳÉÏʹÓà mysqladmin extended-status ÃüÁî»ñµÃÕâЩÏûÏ¢¡£ show [session|global] status ¿ÉÒÔ¸ù¾ÝÐèÒª¼ÓÉϲÎÊý&ldquo ......
½ñÌìÏÂÁ˸öWIN7µÄÓ¢ÎÄ°ü°Ñϵͳ»»³ÉÓ¢Îĵġ£¸Ð¾õ»¹ÐУ¬¿ÉÊǵ±´´½¨Êý¾Ý¿â±íʱ·¢ÏÖ³ö´íÁË£¬²éÁËϲÅÖªµÀÊÇSQLµÄÅÅÐò³öÎÊÌâÁË
ÏÂÃæÊÇCTRL+c V¸ã¹ýÀ´µÄ£¬Ö»ÊÇ·½±ã´ó¼ÒÓÐÕâÑùµÄÎÊÌâ¿ÉÒԵõ½½â¾ö
ʹÓÃSQL2005½øÐд´½¨Êý¾Ý¿âµÄʱºò£¬Èç¹ûÓöµ½´´½¨Ê§°ÜµÄÇé¿ö£¬ÈçÏ£º
Create ¶ÔÓÚ Êý¾Ý¿â“xxxx”ʧ°Ü¡£ (Microsoft.SqlS ......
SQLServerºÍOracleµÄ³£Óú¯Êý¶Ô±È
¡¡¡¡1.¾ø¶ÔÖµ
¡¡¡¡S:select abs(-1) value
¡¡¡¡O:select abs(-1) value from dual
¡¡¡¡2.È¡Õû(´ó)
¡¡¡¡S:select ceiling(-1.001) value
¡¡¡¡O:select ceil(-1.001) value from dual
¡¡¡¡3.È¡Õû£¨Ð¡£©
¡¡¡¡S:select floor(-1.001) value
¡¡¡¡O:select floor(-1.001) value fr ......
SQL SERVER 2008 Òì²½²¶»ñ±íÊý¾ÝÐÞ¸Ä
дµÄ²»¶ÔµÄµØ·½Çë¸÷λָÕý£¬Ð´µÄÒ²±È½ÏÂÒ¡£½²¾¿Õâ¿´°É¡£^ ^
/*
SQL SERVER 2008 Òì²½²¶»ñ±íÊý¾ÝÐÞ¸Ä
SQL server 2008ΪÒì²½¸ú×ÙËùÓз¢ÉúÔÚÓû§±íÉϵÄÊý¾ÝÐÞ¸ÄÌṩÁËÄÚ½¨µÄ·½·¨,
¶ø²»ÐèÒª±àд×Ô¶¨ÒåµÄ´¥·¢Æ÷»òÕß²éѯ,±ä¸üÊý¾Ý²¶»ñÓµÓÐ×îСÐÔÄÜ¿ªÏú,¿ÉÒÔ
Ó ......