ÔÚSQLÓï¾äÖнØÈ¡×Ö·û´®º¯ÊýµÄÓ¦ÓÃ
ÎÊÌâÒ»
ÓÐÕâÑùµÄÒ»¸öÎÊÌ⣬Êý¾Ý¿âÖÐÓÐÁ½¸ö±í£¬·Ö±ðÊÇGuest,Hotel£¬¼´ÂÿÍÐÅÏ¢±íºÍÂùÝÐÅÏ¢±í£¬Guest±íÖÐÓÐÒ»¸öÂÿͱàÂëµÄ×ֶΣ¬Õâ¸ö×ֶεÄÓÐ20룬ËüµÄǰ10λ´ú±íÕâ¸öÂÿÍËùסµÄÂùݣ¬ÏÖÔÚµÄÎÊÌâÊÇÒª¸ù¾ÝGuest±íÖеÄÂÿͱàÂë×Ö¶ÎÐÅÏ¢²éµ½ËûËùסµÄÂùݵÄÃû³ÆºÍÂùݵØÖ·£¡
ÎÊÌâ½â¾ö:
SQL SERVERµÄSQLÓï¾ä£ºselect Guest.ÂÿͱàÂë,Guest.ÂÿÍÐÕÃû,Hotel.ÂùÝÃû³Æ,Hotel.ÂùݵØÖ· from Guest,Hotel where Hotel.ÂùݱàÂë=SubString(Guest.ÂÿͱàÂë,1,10)
OracleµÄSQLÓï¾ä£ºselect Guest.ÂÿͱàÂë,Guest.ÂÿÍÐÕÃû,Hotel.ÂùÝÃû³Æ,Hotel.ÂùݵØÖ· from Guest,Hotel where Hotel.ÂùݱàÂë=SubStr(Guest.ÂÿͱàÂë,1,10)
ÎÊÌâ¶þ
A.½ØÈ¡´Ó×Ö·û´®×ó±ß¿ªÊ¼N¸ö×Ö·û
Declare @S1 varchar(100)
Select @S1='http://www.xrss.cn'
Select Left(@S1,4)
------------------------------------
ÏÔʾ½á¹û: http
B.½ØÈ¡´Ó×Ö·û´®Óұ߿ªÊ¼N¸ö×Ö·û(ÀýÈçÈ¡×Ö·ûwww.163.com)
Declare @S1 varchar(100)
Select @S1='http://www.xrss.cn'
Select right(@S1,11)
------------------------------------
ÏÔʾ½á¹û: www.163.com £¿£¿£¿£¿
C.½ØÈ¡×Ö·û´®ÖÐÈÎÒâλÖü°³¤¶È(ÀýÈçÈ¡×Ö·ûwww)
Declare @S1 varchar(100)
Select @S1='http://www.xrss.cn'
Select SUBSTRING(@S1,8,3)
------------------------------------
ÏÔʾ½á¹û: www.163.com
ÒÔÉÏÀý×Ó½ÔÊÇÒÑÖª½ØÈ¡Î»Öü°³¤¶È,ÏÂÃæ½éÉÜδ֪λÖõÄÀý×Ó
2.½ØÈ¡Î´ÖªÎ»Öõĺ¯Êý
&n
Ïà¹ØÎĵµ£º
¡¾1¡¿
create procedure proc_pager1
( @pageIndex int, -- ҪѡÔñµÚXÒ³µÄÊý¾Ý
@pageSize int -- ÿҳÏÔʾ¼Ç¼Êý
)
AS
BEGIN
declare @sqlStr varchar(500)
set @sqlStr='select top '+con ......
Ò»¡¢±³¾°½éÉÜ
¡¡¡¡
¡¡¡¡½á¹¹»¯²éѯÓïÑÔ(Structured Query Language£¬¼ò³ÆSQL)ÊÇÓÃÀ´·ÃÎʹØÏµÐÍÊý¾Ý¿âÒ»ÖÖͨÓÃÓïÑÔ£¬ÊôÓÚµÚËÄ´úÓïÑÔ£¨4GL£©£¬ÆäÖ´ÐÐÌØµãÊǷǹý³Ì»¯£¬¼´²»ÓÃÖ¸Ã÷Ö´ÐеľßÌå·½·¨ºÍ;¾¶£¬¶øÊǼòµ¥µØµ÷ÓÃÏàÓ¦Óï¾äÀ´Ö±½ÓÈ¡µÃ½á¹û¼´¿É¡£ÏÔÈ»£¬ÕâÖÖ²»¹Ø×¢ÈκÎʵÏÖϸ½ÚµÄÓïÑÔ¶ÔÓÚ¿ª·¢ÕßÀ´ËµÓÐ׿«´óµÄ±ãÀû¡£È»¶ø£¬Ó ......
˵µ½Èí½âÎö£¨soft prase
£©ºÍÓ²½âÎö£¨
hard prase
£©£¬¾Í²»Äܲ»ËµÒ»ÏÂ
Oracle
¶Ô
sql
µÄ´¦Àí¹ý³Ì¡£µ±Äã·¢³öÒ»Ìõ
sql
Óï¾ä½»¸¶
Oracle
£¬ÔÚÖ´ÐкͻñÈ¡½á¹ûǰ£¬
Oracle
¶Ô´Ë
sql
½«½øÐм¸¸ö²½ÖèµÄ´¦Àí¹ý³Ì£º
1¡¢Óï·¨¼ì²é£¨
syntax check
£©
&nb ......
-- create by zh
-- n ÊÇ×÷ÎïµÄʱ¼ä,x ÊÇÏ£ÍûÔÚ¼¸µã³ÉÊì,·µ»Ø²¥ÖÖµÄʱ¼ä
with t as
(
select 64 n,9 x from dual union all
select 64 n,13 x from dual union all
select 64 n,17 x from dual union all
select 64 n,20 x from dual
)
select '³ÉÊìʱ¼ä:' || lpad(to_char(n),4,' ' ......
ÔÚÎÒÃÇÈÕ³£Ê¹ÓÃSQL ServerÊý¾Ý¿âʱ£¬¾³£Óöµ½ÐèÒªÔÚʵÀýInstance01ÖпçʵÀý·ÃÎÊInstance02ÖеÄÊý¾Ý¡£ÀýÈçÔÚ×öÊý¾ÝÇ¨ÒÆÊ±£¬ÈçÏÂÓï¾ä:
insert into Instance01.DB01.dbo.Table01
select * from Instance02.DB01.dbo.Table01
ÆÕͨÇé¿öÏ£¬ÕâÑù×öÊDz»ÔÊÐíµÄ£¬ÒòΪSQ ......