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

¡¾¸Äб¹éÕý¡¿ sqlserver sql ·ÖÒ³Óï¾ä

      ÔÚGoogleÉÏʹÓÓsql ·ÖÒ³”¹Ø¼ü×Ö½øÐÐËÑË÷£¬¼¸ºõËùÓеĴ𰸶¼ÊÇÄÇÈýÌõ¡£Æä¶þЧÂÊ×î¸ß£¬ÆäÈýʹÓÃÓα꣬ЧÂÊ×î²î¡£
      ÏÂÃæÊÇÄÇÈýÖÖ·½·¨ £¨²åÈë´úÂëûÓÐsqlÑ¡Ï
·½·¨1£º
ÊÊÓÃÓÚ SQL Server 2000/2005
SELECT TOP Ò³´óС *
from table1
WHERE id NOT IN
(
SELECT TOP Ò³´óС*(Ò³Êý-1) id from table1 ORDER BY id
)
ORDER BY id
·½·¨2£º
ÊÊÓÃÓÚ SQL Server 2000/2005
SELECT TOP Ò³´óС *
from table1
WHERE id >
(
SELECT ISNULL(MAX(id),0)
from
(
SELECT TOP Ò³´óС*(Ò³Êý-1) id from table1 ORDER BY id
) A
)
ORDER BY id
·½·¨3£º
ÊÊÓÃÓÚ SQL Server 2005
SELECT TOP Ò³´óС *
from
(
SELECT ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,* from table1
) A
WHERE RowNumber > Ò³´óС*(Ò³Êý-1)
      ´ÖÂÔ¿´ÁË£¬ÕâÈýÖÖ·½·¨¶¼Ã»ÓÃ´í¡£ËµµÄ¶¼ÓÐÀí¡£Ïà¶ÔÀ´ËµÇ°Á½ÖÖ·½·¨¶ÔÓÚ´øÌõ¼þµÄ²éѯ²»¹»·½±ã¡£
      ÖÁÓÚЧÂÊ£¬½ñÌìʵ¼Ê¼ÓÁËÌõ¼þ²âÊÔһϡ£Êµ¼ÊËٶȲ¢²»ÊÇ·½°¸2×î¿ì£¬·½°¸3×îÂý¡£Êµ¼ÊÇé¿öÊÇ·½°¸3×î¿ì£¬·½°¸1´ÎÖ®£¬·½°¸2×îÂý¡£ÓëÍøÉϽá¹û½ØÈ»Ïà·´¡£µ«ÊÇ·½°¸3ÓÐÒ»¸ö·Ç³£Òª½ôµÄ´íÎó£ºÃ»ÓÐÅÅÐò¡£Ö±½ÓʹÓÿÉÄܻᵼÖ´íÎó¡£
      ²»¼ÓÌõ¼þµÄ²âÊÔ½á¹ûÊÇÒ»ÑùµÄ¡£
      ·½°¸3µÄÕýÈ·Ó÷¨ÊÇ£º
SELECT TOP 10 * from tt
SELECT TOP Ò³´óС *
from
(
SELECT ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,* from table1
) A
WHERE RowNumber > Ò³´óС*(Ò³Êý-1) ORDER BY RowNumber
ÒÔÏÂÊDzâÊÔ·½°¸¡£
´´½¨ÏÂ±í£º
USE [BigDb]
GO
/****** Object: Table [dbo].[t7] Script Date: 02/20/2010 20:35:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[t7](
[id] [int] IDENTITY(1,1) NOT NULL,
[pid] [int] NOT NULL,
[sex] [bit] NOT NULL,
[name] [nchar](5) COLLATE Chinese_PRC_CI_AS NOT NULL,
[age] [int] NOT NULL,
[time] [datetime] NOT NULL,
[note] [ntext] CO


Ïà¹ØÎĵµ£º

×ܽáÒ»µãAccessÓëSqlserverµÄsqlµÄ²îÒì

×î½üÕûÀí³öÀ´µÄ.Èç¹û²»ÍêÈ«µÄ»°Ï£Íû´ó¼Ò²¹³ä.
ÔÚaccessÖУ¬×ª»»Îª´óдµÄsqlº¯ÊýÊÇucase£¬ÔÚsqlserverÖУ¬×ª»»Îª´óдµÄº¯ÊýÊÇupper£»ÔÚaccessÖУ¬×ª»»ÎªÐ¡Ð´µÄº¯ÊýÊÇlcase£¬ÔÚsqlserverÖУ¬×ª»»ÎªÐ¡Ð´µÄº¯ÊýÊÇlower£»ÔÚaccessÖУ¬È¡µ±Ç°Ê±¼äµÄº¯ÊýÊÇnow£¬ÁíÍ⻹ÓÐÒ»¸öÈ¡ÈÕÆÚº¯Êýdate£¬ÔÚsqlserverÖУ¬È¡µ±Ç°µÄº¯ÊýÊÇgetdate ......

¾­µäSQLÓï¾ä

1,SELECT *,CASE OrderStatus WHEN 1 THEN 'δ´¦Àí' when 2 THEN 'Ëø¶¨' when
3 THEN 'ÒѳöƱ' ELSE '¹ýÆÚ' END
from  dbo.T_OrderItem
2,
SELECT *,CAST(ROUND(CAST (HostWin AS FLOAT)/(HostWin+HostDraw+HostBear),2)*100 AS varchar)+'%' AS HostWinRate,
        & ......

Ìí¼ÓÊý¾ÝÔ´²¢ÅäÖÃÊý¾ÝÔ´Óësql ServerÉí·ÝÑé֤ģʽ

      ÔÚÊý¾Ý¿âÓ¦ÓóÌÐò·¢²¼Ê±£¬¿Í»§¶Ë°²×°ÔÚ¾ÖÓòÍøÖеÄÖ÷»úAÉÏ£¬sql server °²×°ÔڸþÖÓòÍøµÄÖ÷»úBÉÏ¡£¿Í»§¶ËÈí¼þÖаüº¬ÓÐËüÒªÁ¬½ÓµÄÊý¾Ý¿âµÄÐÅÏ¢¡£ÈçÊý¾ÝÔ´£¬·þÎñÆ÷Ãû³Æ£¬Êý¾Ý¿âµÈ£¬ÊµÀý£ºdata source=SQLOLEDB;SERVER=DongZi\sqlExpress;uid=sa;pwd=123;database=MachineRoom
¡£ÄÇôÎÒÃÇÔÚÖ÷» ......

Oracle SQLµÄÓÅ»¯

SQLµÄÓÅ»¯Ó¦¸Ã´Ó5¸ö·½Ãæ½øÐе÷Õû£º
1.È¥µô²»±ØÒªµÄ´óÐͱíµÄÈ«±íɨÃè
2.»º´æСÐͱíµÄÈ«±íɨÃè
3.¼ìÑéÓÅ»¯Ë÷ÒýµÄʹÓÃ
4.¼ìÑéÓÅ»¯µÄÁ¬½Ó¼¼Êõ
5.¾¡¿ÉÄܼõÉÙÖ´Ðмƻ®µÄCost
SQLÓï¾ä£º
ÊǶÔÊý¾Ý¿â(Êý¾Ý)½øÐвÙ×÷µÄΩһ;¾¶£»
ÏûºÄÁË70%~90%µÄÊý¾Ý¿â×ÊÔ´£»¶ÀÁ¢ÓÚ³ÌÐòÉè¼ÆÂß¼­£¬Ïà¶ÔÓÚ¶Ô³ÌÐòÔ´´úÂëµÄÓÅ»¯£¬¶ÔSQLÓï¾äµÄÓÅ»¯Ô ......

SQL²éѯЧÂÊ 100wÊý¾Ý²éѯֻҪ1Ãë

»úÆ÷Çé¿ö
p4: 2.4
ÄÚ´æ: 1 G
os: windows 2003
Êý¾Ý¿â: ms sql server 2000
Ä¿µÄ: ²éѯÐÔÄܲâÊÔ,±È½ÏÁ½ÖÖ²éѯµÄÐÔÄÜ
SQL²éѯЧÂÊ step by step
-- setp 1.
-- ½¨±í
create table t_userinfo
(
userid int identity(1,1) primary key nonclustered,
nick&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ