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

SQL ÐÐÊýµÄÑ¡Ôñ

OracleÊý¾Ý¿â
SELECT
    *
from
(
    SELECT
        ROWNUM AS NO_ROW
        ,row_.*
    from
    (
        SELECT
            *
        from
            PLAN_TEMP
    ) row_
)
WHERE
    NO_ROW BETWEEN 1 AND 12
PostgreSQL
select * from table limit 1 offset 12;
MySQL
select * from table limit 1, 12
SQL Server
select top 12 * from table
·ÖÒ³£º
1.Oracle
SELECT
    *
from (
    SELECT
        row_.*, rownum rownum_
    from
        (...... ) row_
    WHERE
        rownum <= ?)
WHERE rownum_ > ?
ÏÈ°´²éѯÌõ¼þ²éѯ³ö´Ó0 µ½Ò³Î´µÄ¼Ç¼.È»ºóÔÙÈ¡³ö´ÓÒ³¿ªÊ¼µ½Ò³Î´µÄ¼Ç¼.(¾Ý˵ÊÇЧÂÊ×î¸ßµÄ£º£©)  
2. SQL Server
i:select top [pagesize] *
from table
where
    id not in (
        select top [pagesize*(currentpage-1)] id
        from table
        [²éѯÌõ¼þ] order by   id )
    and [²éѯÌõ¼þ] order by id
ÏÈ°´²éѯÌõ¼þÅųý pagesize*[pagesize* (currentpage-1)]ÒÔÇ°µÄ¼Í¼¡£&&ÔÙ°´²éѯÌõ¼þ°ÑËûÒÔºóµÄ¼Ç¼ top[pagesize] ³ö À´.
ii: select top PageSize *
from TableName
where id > (
    select max(id)  
    from
        (select top startRecord-1 id
        from TableName
        [²éѯÌõ¼þ]
      


Ïà¹ØÎĵµ£º

oracleÖбȽÏʵÓÃsqlÓï¾ä

-- ²é¿´ORACLE Êý¾Ý¿âÖб¾Óû§ÏµÄËùÓбí
SELECT table_name from user_tables;
-- ²é¿´ORACLE Êý¾Ý¿âÖÐËùÓÐÓû§ÏµÄËùÓбí
select user,table_name from all_tables;
-- ²é¿´ORACLE Êý¾Ý¿âÖб¾Óû§ÏµÄËùÓÐÁÐ
select table_name,column_name from user_tab_columns;
-- ²é¿´ORACLE Êý¾Ý¿âÖб¾Óû§ÏµÄËùÓÐÁÐ
se ......

Oracle SQLʵÀý

1¡£select * from a where a.rowid=(select min(b.rowid) from b where a.id=b.id);
create test1(
nflowid number primary key, 
ndocid number,
drecvdate date);
insert into test1 values (1, 12301, sysdate) ;
insert into test1 values (2, 12301, sysdate);
select * from test1 order by drecvdate:
......

SQL Server 2005ÖеÄT SQLÔöÇ¿D

µÝ¹éµÄͨÓñí±í´ïʽ
µÝ¹éµÄCTEÊǸù¾ÝÖÁÉÙÁ½¸ö²éѯ£¨»òÕß³ÆΪÁ½¸ö³ÉÔ±£©¹¹½¨µÄ£¬Ò»¸öÊǷǵݹé²éѯ£¬Ò²³ÉΪ¹Ì¶¨³ÉÔ±£¬Ö»Äܵ÷ÓÃÒ»´Î£¬ÁíÍâÒ»¸öÊǵݹé²éѯ£¬Ò²³ÉΪµÝ¹é³ÉÔ±£¨RM£©£¬¿ÉÒÔ·´¸´µ÷Óã¬Ö±µ½²éѯ²»ÔÙ·µ»ØÐС£²éѯÓÉUNION ALLÔËËã·ûÁ¬½ÓΪһ¸öµ¥¶ÀµÄCTE¡£
--ʹÓõݹéµÄͨÓñí±í´ïʽ
GO
CREATE TABLE CarParts
( ......

SQL Server 2005ÖеÄT SQLÔöÇ¿F

DDL´¥·¢Æ÷ DDL Triggers
SQL Server 2005¿ÉÒÔ¾ÍÕû¸ö·þÎñÆ÷»òÊý¾Ý¿âµÄij¸ö·¶Î§ÎªDDLʼþ¶¨Òå´¥·¢Æ÷¡£Ò²¿ÉÒÔΪµ¥¸öDDLÓï¾ä£¨ÀýÈ磺CREAT_TABLE¡¢DROP_TABLEµÈ£©»òÕßΪһ×éÓï¾ä£¨ÀýÈ磺ָ¶¨DDL_DATABASE_LEVEL_EVENTSÏëÒª´¥·¢Æ÷´¥·¢Êý¾Ý¿âËùÓÐDDLʼþ£©¶¨ÒåDDL´¥·¢Æ÷¡£
ÔÚDDL´¥·¢Æ÷ÄÚ²¿£¬¿ÉÒÔͨ¹ý·ÃÎÊeventdata()º¯Êý»ñµÃÓ ......

¡¾×ª¡¿mysqlÏÂÈçºÎÖ´ÐÐsql½Å±¾

Ê×Òª²½Öè(Ò»°ã¿ÉÊ¡ÂÔ):
¿ªÆômysql·þÎñ(ĬÈÏÊÇ¿ª»úʱ¾Í×Ô¶¯ÔËÐÐÁË):
¿ØÖÆÃæ°å
-->¹ÜÀí¹¤¾ß-->·þÎñ,ÔÚÀïÃæÕÒµ½Ãû³ÆΪmysqlµÄÏî,Ë«»÷¾Í¿É¿´ËüµÄ·þÎñ״̬ÊÇÆô¶¯»¹ÊÇÍ£Ö¹,°ÑËüÉèΪÆô¶¯
Á¬½Ómysql:
ÔÚÃüÁîÐÐÏÂÊäÈë mysql -h
localhost -u root -p»Ø³µ,È»ºóÊäÈëÃÜÂë¼´¿É;»òÖ±½ÓÔËÐÐmysql×Ô´øµÄÁ¬½Ó¹¤¾ß,È»ºóÊäÈëÃÜÂë¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ