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

sqlÍêÈ«½âÎö

1¡¢¼òµ¥²éѯ
Çó³öÔÚ1988ÄêÒÔÇ°±»¹ÍÓ¶µÄÏúÊÛÈËÔ±
SELECT NAME
 from SALESREPS
WHERE HIRE_DATE<'01-JAN-88'
ÁгöÆäÏúÊÛÁ¿µÍÓÚÏúÊÛÄ¿±êµÄ80%µÄÏúÊÛµã
SELECT CITY,SALES,TAGET
from SALESPEPS
WHERE SALES<0.8*TAGET


Ïà¹ØÎĵµ£º

»Ö¸´oracleÖÐÓÃpl sqlÎóɾ³ýdropµôµÄ±í


²é¿´»ØÊÕÕ¾Öбí
select object_name,original_name,partition_name,type,ts_name,createtime,droptime from recyclebin;
»Ö¸´±í
SQL
>flashback table test_drop to before drop;»ò
SQL
>flashback table "BIN$b+XkkO1RS5K10uKo9BfmuA==$0" to befor ......

ms sql case when elseÓï¾äʹÓü¼ÇÉ

    ¹¤×÷ÖÐÅöµ½µÄС¼¼ÇÉ£¬±ÈÈç˵ҪÓÃÊý¾Ý±íÀïÈ¡³ö×¢²áÓû§µÄ×ÊÁÏ£¬ÐÔ±ðΪ1ÔòÏÔʾΪÄÐÉú£»ÐÔ±ðΪ2ÔòÏÔʾΪŮÉú£»ÒÔÇ°¶¼ÊÇ´Ó±íÀïÈ¡³öÊý¾Ý£¬È»ºóÔÙÓôúÂë½øÐÐÅжϣ¬Îª1ÔòÏÔʾΪÄÐÉú£»Îª2ÔòÏÔʾΪŮÉú£»Æäʵµ¥ÓÃSQLÓï¾ä¾Í¿ÉÒÔ×öµ½£¬ÈçÏ£º
Ö±½ÓʹÓÃcase when else Óï¾ä
Case¾ßÓÐÁ½ÖÖ¸ñʽ¡£¼òµ¥Caseº¯ÊýºÍCaseË ......

SQLÓï¾äÖÐ N ºó½ÓÐø×Ö·û´®µÄ×÷ÓÃ

È磺SET @sql=N'SELECT * from stu'
ÆäÖГN”µÄ×÷ÓÃÊDZíʾºóÃæµÄ±àÂë¸ñʽΪunicode±àÂë
DECLARE @rst INT,@sql NVARCHAR(4000)
SET @sql=N'SELECT * from tb '
EXEC sp_executesql @sql,N'@rst INT OUTPUT',@rst OUTPUT
SELECT @rst
......

SQL·ÖÒ³Óï¾ä

±àÂë¹ý³ÌÖÐÓöµ½µÄSQL·ÖÒ³Çé¿ö£¬×ܽ᣺
´ÓÊý¾Ý¿â±íÖеÚMÌõ¼Ç¼¿ªÊ¼¼ìË÷NÌõ¼Ç¼
MySQL£º
ÏȲéѯ·ÖÒ³£¬È»ºóÅÅÐò£º
select * from (select * from student  limit 5,2) pageTable order by id desc  ;
ÏÈÅÅÐò£¬È»ºó²éѯ·ÖÒ³£ºselect * from student order by id desc limit 5,2  ;
Oracle£º
SELECT * fro ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ