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

SQL Substring

 SQL ÖÐµÄ substring º¯ÊýÊÇÓÃÀ´×¥³öÒ»¸öÀ¸Î»×ÊÁÏÖÐµÄÆäÖÐÒ»²¿·Ö¡£Õâ¸öº¯ÊýµÄÃû³ÆÔÚ²»Í¬µÄ×ÊÁÏ¿âÖв»ÍêȫһÑù£º
MySQL: SUBSTR(), SUBSTRING()
Oracle: SUBSTR()
SQL Server: SUBSTRING()
×î³£Óõ½µÄ·½Ê½ÈçÏ (ÔÚÕâÀïÎÒÃÇÓÃSUBSTR()ΪÀý)£º
SUBSTR(str,pos): ÓÉ<str>ÖУ¬Ñ¡³öËùÓдӵÚ<pos>λÖÿªÊ¼µÄ×ÖÔª¡£Çë×¢Ò⣬Õâ¸öÓï·¨²»ÊÊÓÃÓÚSQL ServerÉÏ¡£
SUBSTR(str,pos,len): ÓÉ<str>ÖеĵÚ<pos>λÖÿªÊ¼£¬Ñ¡³ö½ÓÏÂÈ¥µÄ<len>¸ö×ÖÔª¡£
¼ÙÉèÎÒÃÇÓÐÒÔϵıí¸ñ£º
Geography ±í¸ñ
region_name
store_name
East
Boston
East
New York
West
Los Angeles
West
San Diego
Àý1:
SELECT SUBSTR(store_name, 3) 
from Geography 
WHERE store_name = 'Los Angeles';
½á¹û:
's Angeles'
Àý2:
SELECT SUBSTR(store_name,2,4) 
from Geography 
WHERE store_name = 'San Diego';
½á¹û:
'an D' 


Ïà¹ØÎĵµ£º

¾«ÃîSQL語¾ä

      1. ˵Ã÷£º¸´ÖƱí(Ö»¸´Öƽṹ£¬Ô´±íÃû£ºa£¬Ð±íÃû£ºb)
SQL: select * into b from a where 1<>1;
        2. ˵Ã÷£º¿½±´±í(¿½±´Êý¾Ý£¬Ô´±íÃû£ºa£¬Ä¿±ê±íÃû£ºb)
SQL: insert into b(a, b, c) select d, e, f from b;
   &nb ......

Comparison of SQL and MDX Syntax

          Comparison of SQL and MDX Syntax
The Multidimensional Expressions (MDX) syntax is similar to the syntax of Structured Query Language (SQL). In many ways, the functionality supplied by MDX is also similar to that of SQL; with effort, you can eve ......

sql(left join,right jion,inner join)Á¬½ÓÏê½â

 ¹ØÓÚsqlÁ¬½Ó
Á¬½ÓÀàÐÍ
ÔÚ¹ØÏµ´úÊýÖУ¬Á¬½ÓÔËËãÊÇÓÉÒ»¸öµÑ¿¨¶û»ýÔËËãºÍÒ»¸öѡȡÔËËã¹¹³ÉµÄ¡£Ê×ÏÈÓõѿ¨¶û»ýÍê³É¶ÔÁ½¸öÊý¾Ý¼¯ºÏµÄ³ËÔËË㣬Ȼºó¶ÔÉú³ÉµÄ½á¹û
¼¯ºÏ½øÐÐѡȡÔËË㣬ȷ±£Ö»°Ñ·Ö±ðÀ´×ÔÁ½¸öÊý¾Ý¼¯ºÏ²¢ÇÒ¾ßÓÐÖØµþ²¿·ÖµÄÐкϲ¢ÔÚÒ»Æð¡£Á¬½ÓµÄÈ«²¿ÒâÒåÔÚÓÚÔÚˮƽ·½ÏòÉϺϲ¢Á½¸öÊý¾Ý¼¯ºÏ£¨Í¨³£ÊÇ±í£©£¬²¢²úÉú
Ò ......

sql ±íÐÞ¸ÄÁÐ

 create table #a
(
a int identity(1,1) primary key,
b int default(0) not null,
c nvarchar(20)
)
insert into #a(c)
select 'a' union all
select 'b' union all
select 'c' union all
select 'd' union all
select 'e'
select * from #a
alter table #a drop constraint DF__#a_____________b__12 ......

sqlÖн«×Ö¶Îת³ÉDecimal


update CHELIANG_MINGDAN set clmd_yunxuzaizhong = cast(clmd_yunxuzaizhong/1000 as decimal(14,4)) where clmd_yunxuzaizhong is not null
update CHELIANG_MINGDAN set clmd_carweight = cast(clmd_carweight/1000 as decimal(14,4)) where clmd_carweight is not null ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ