¼¸Ìõ³£¼ûµÄÊý¾Ý¿â·ÖÒ³ SQL Óï¾ä
SQL Server
¡¡¡¡´ÓÊý¾Ý¿â±íÖеĵÚMÌõ¼Ç¼¿ªÊ¼È¡NÌõ¼Ç¼£¬ÀûÓÃTop¹Ø¼ü×Ö£º×¢ÒâÈç¹ûSelectÓï¾äÖмÈÓÐtop£¬ÓÖÓÐorder by£¬ÔòÊÇ´ÓÅÅÐòºÃµÄ½á¹û¼¯ÖÐÑ¡Ôñ£º
¡¡¡¡SELECT *
¡¡¡¡from ( SELECT Top N *
¡¡¡¡from (SELECT Top (M + N - 1) * from ±íÃû³Æ Order by Ö÷¼ü desc) t1 ) t2
¡¡¡¡Order by Ö÷¼ü asc
¡¡¡¡ÀýÈç´Ó±íSys_option(Ö÷¼üΪsys_id)ÖдÓ10Ìõ¼Ç¼»¹ÊǼìË÷20Ìõ¼Ç¼£¬Óï¾äÈçÏ£º
¡¡¡¡SELECT *
¡¡¡¡from ( SELECT TOP 20 *
¡¡¡¡from (SELECT TOP 29 * from Sys_option order by sys_id desc) t1) t2
¡¡¡¡Order by sys_id asc
¡¡¡¡OralceÊý¾Ý¿â
¡¡¡¡´ÓÊý¾Ý¿â±íÖеÚMÌõ¼Ç¼¿ªÊ¼¼ìË÷NÌõ¼Ç¼
¡¡¡¡SELECT *
¡¡¡¡from (SELECT ROWNUM r,t1.* from ±íÃû³Æ t1 where rownum < M + N) t2
¡¡¡¡where t2.r >= M
¡¡¡¡ÀýÈç´Ó±íSys_option(Ö÷¼üΪsys_id)ÖдÓ10Ìõ¼Ç¼»¹ÊǼìË÷20Ìõ¼Ç¼£¬Óï¾äÈçÏ£º
¡¡¡¡SELECT *
¡¡¡¡from (SELECT ROWNUM R,t1.* from Sys_option where rownum < 30 ) t2
¡¡¡¡Where t2.R >= 10
¡¡¡¡MySQLÊý¾Ý¿â
¡¡¡¡My sqlÊý¾Ý¿â×î¼òµ¥£¬ÊÇÀûÓÃmysqlµÄLIMITº¯Êý,LIMIT [offset,] rows´ÓÊý¾Ý¿â±íÖÐMÌõ¼Ç¼¿ªÊ¼¼ìË÷NÌõ¼Ç¼µÄÓï¾äΪ£º
ÒÔÏÂÊÇÒýÓÃƬ¶Î£º
¡¡¡¡SELECT * from ±íÃû³Æ LIMIT M,N
¡¡¡¡ÀýÈç´Ó±íSys_option(Ö÷¼üΪsys_id)ÖдÓ10Ìõ¼Ç¼»¹ÊǼìË÷20Ìõ¼Ç¼£¬Óï¾äÈçÏ£º
ÒÔÏÂÊÇÒýÓÃƬ¶Î£º
¡¡¡¡select * from sys_option limit 10,20
DB2Êý¾Ý¿â
DB2·ÖÒ³²éѯ
SELECT * from (Select ×Ö¶Î1,×Ö¶Î2,×Ö¶Î3,rownumber() over(ORDER BY ÅÅÐòÓõÄÁÐÃû ASC) AS rn from ±íÃû) AS a1
WHERE a1.rn BETWEEN 10 AND 20
ÒÔÉϱíʾÌáÈ¡µÚ10µ½20µÄ¼Í¼
&n
Ïà¹ØÎĵµ£º
create PROCEDURE sp_decrypt(@objectname varchar(50))
AS
begin
set nocount on
--CSDN£ºj9988 copyright:2004.07.15
--V3.2
--Æƽâ×Ö½Ú²»ÊÜÏÞÖÆ£¬ÊÊÓÃÓÚSQLSERVER2000´æ´¢¹ý³Ì£¬º¯Êý£¬ÊÓͼ£¬´¥·¢Æ÷
--ÐÞÕýÉÏÒ»°æ"ÊÓͼ´¥·¢Æ÷"²»ÄÜÕýÈ·½âÃÜ´íÎó
--·¢ÏÖÓÐ´í£¬ÇëE_MAIL£ºCSDNj9988@tom.com
begin tran
......
1:replace º¯Êý
µÚÒ»¸ö²ÎÊýÄãµÄ×Ö·û´®£¬µÚ¶þ¸ö²ÎÊýÄãÏëÌæ»»µÄ²¿·Ö£¬µÚÈý¸ö²ÎÊýÄãÒªÌæ»»³Éʲô
select replace('lihan','a','b')
&nb ......
±à¼Ç°ÑÔ£ºÕâ¸öÎÄÕÂÎÒûÓвâÊÔ£¬µ«Ç°ÌáÌõ¼þ»¹ÊǺܶ࣬±ÈÈçÒ»¶¨ÒªÓбðµÄ³ÌÐò´æÔÚ£¬¶øÇÒÒ²ÒªÓÃͬһ¸öSQLSERVER¿â£¬»¹µÃ¼ÙÉèÓÐ×¢È멶´¡£Ëµµ½µ×ºÍ¶¯ÍøûÓÐʲô¹Øϵ£¬µ«ÒòΪ¶¯ÍøÂÛ̳µÄ¿ª·ÅÐÔ£¬ÈÃÈËÊìϤÁËÆäÊý¾Ý¿â½á¹¹£¬ºÍ³ÌÐòÔË×÷·½·¨¡£ÔÚÒ»²½²½µÄ¹¥»÷ÖÐÈ¡µÃ¹ÜÀíȨÏÞ£¬ÔÙÒ»²½²½µÄÌáÉýȨÏÞ£¬Èç¹ûÕýºÃÊý¾Ý¿âÓõÄÊÇSAÕʺţ¬¾Í¸üÊÇ ......
--oracleÓÅ»¯slqÓï¾ä
£¨1£©Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
¡¡¡¡OracleµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äú±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£¼ÙÈçÓÐ3¸öÒÔÉ쵀 ......
.Çå¿ÕÈÕÖ¾
DUMP TRANSACTION ¿âÃû WITH NO_LOG
2.½Ø¶ÏÊÂÎñÈÕÖ¾£º
BACKUP LOG ¿âÃû WITH NO_LOG
3.ÊÕËõÊý¾Ý¿âÎļþ(Èç¹û²»Ñ¹Ëõ,Êý¾Ý¿âµÄÎļþ²»»á¼õС
ÆóÒµ¹ÜÀíÆ÷--ÓÒ¼üÄãҪѹËõµÄÊý¾Ý¿â--ËùÓÐÈÎÎñ--ÊÕËõÊý¾Ý¿â--ÊÕËõÎļþ--Ñ¡ÔñÈÕÖ¾Îļþ--ÔÚÊÕËõ·½Ê½ÀïÑ¡ÔñÊÕËõÖÁXXM,ÕâÀï»á¸ø³öÒ»¸öÔÊÐíÊÕËõµ½µÄ×îСMÊý,Ö±½Ó ......