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

sqlÊý×ÖתӢÎÄ

create function decodehundred(@hundredstring varchar(300) )
returns  varchar(1000)
as
begin
declare  @tmp varchar(1000),@decodehundred varchar(1000)
set @decodehundred = ''
declare @strno1 varchar(1000)
select  @strno1 = 'One       Two       Three     Four      Five      ' +
                  'Six       Seven     Eight     Nine      Ten       ' +
                  'Eleven    Twelve    Thirteen  Fourteen  Fifteen   '+
                  'Sixteen   Seventeen Eighteen  Nineteen  '
declare @strtens1 varchar(1000)
set @strtens1 =   'Ten       Twenty    Thirty    Forty     Fifty     ' +
                  'Sixty     Seventy   Eighty    Ninety    '
declare @unit4  varchar(10)
set @unit4 = 'Hundred'
if len(@hundredstring) > 0 and len(@hundredstring) <= 3 
begin    
    if len(@hundredstring) = 1
    begin
        set @tmp = cast(@hundredstring as int)
        if @tmp <> 0 
            set @decodehundred =
 &


Ïà¹ØÎĵµ£º

SQL Server 2008 ×èÖ¹±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä


MS SQL Server 2008 ÔÚ½¨Íê±íºó£¬Èç¹ûÒª²åÈëÈÎÒâÁУ¬ÔòÌáʾ£º
µ±Óû§ÔÚÔÚSQL Server 2008ÆóÒµ¹ÜÀíÆ÷Öиü¸Ä±í½á¹¹Ê±£¬±ØÐëÒªÏÈɾ³ýÔ­À´µÄ±í£¬È»ºóÖØд´½¨ÐÂ±í£¬²ÅÄÜÍê³É±íµÄ¸ü¸Ä£¬Èç¹ûÇ¿Ðиü¸Ä»á³öÏÖÒÔÏÂÌáʾ£º²»ÔÊÐí±£´æ¸ü¸Ä¡£ÄúËù×öµÄ¸ü¸ÄÒªÇóɾ³ý²¢ÖØд´½¨ÒÔÏÂ±í¡£Äú¶ÔÎÞ·¨ÖØд´½¨µÄ±ê½øÐÐÁ˸ü¸Ä»òÕßÆôÓÃÁË“× ......

SQL Serverº¯Êý´óÈ«

--¾ÛºÏº¯Êý
use pubs
go
select avg(distinct price)  --Ëãƽ¾ùÊý
from titles
where type='business'
go 
use pubs
go
select max(ytd_sales)  --×î´óÊý
from titles
go 
use pubs
go
select min(ytd_sales) --×îÐ¡Ê ......

OracleÖÐSQL PLUSµÄ³£ÓÃÖ¸Áî

½øÈësql*plusÐèÒªÊäÈëÓû§Ãû¡¢¿ÚÁîºÍÖ÷»ú±êÖ¾·û
system/manager
sys/change_on_intall
scott/tiger
internal/oracle
ÒÔÉÏΪ³õʼÃÜÂë
Ö÷»ú×Ö·û´®¿Õ»òÕßÊÇ@+ÄãµÄ·þÎñÃû,ÔÚ±¾µØµÇ½²»ÐèÒª±¾µØ·þÎñÃû¡£
ÏÂÃæ¾Í½éÉÜÒ»ÏÂһЩ³£ÓõÄsql*plusÃüÁ
Ê×ÏȲ鿴µ±Ç°Ê¹ÓõÄÊý¾Ý¿âʵÀý:
select name from V$database;
Çл»Á½¸ö ......

SQL round()Ïê½â


SQLÖÐround£¨£©º¯ÊýÓ÷¨
SQL round()Ïê½â
roundÓÐÁ½¸öÖØÔØ,Ò»¸öÓдøÓÐÁ½¸ö²ÎÊýµÄ,Ò»¸öÊÇ´øÓÐÈý¸ö²ÎÊýµÄ,
ÿһ¸ö²ÎÊý¶¼ÏàͬÊÇÒª´¦ÀíµÄÊý,
1.´øÓÐÁ½¸ö²ÎÊý.ÿ¶þ¸ö²ÎÊýÊÇСÊýµãµÄ×ó±ßµÚ¼¸Î»»òÓұߵڼ¸Î»,·Ö±ðÓÃÕý¸º±íʾ.×ó±ßΪ¸º,ÓÒ±ßΪ¸º.ΪËÄÉáÎåÈë.
select round(748.585929,-1) 750.000000
select round(748.58592 ......

SQLÓï¾ä£ºGroup By Óï¾äС½á

1. Group By Óï¾ä¼ò½é£º
Group ByÓï¾ä´ÓÓ¢ÎĵÄ×ÖÃæÒâÒåÉÏÀí½â¾ÍÊÇ“¸ù¾Ý(by)Ò»¶¨µÄ¹æÔò½øÐзÖ×é(Group)”¡£ËüµÄ×÷ÓÃÊÇͨ¹ýÒ»¶¨µÄ¹æÔò½«Ò»¸öÊý¾Ý¼¯»®·Ö³ÉÈô¸É¸öСµÄÇøÓò£¬È»ºóÕë¶ÔÈô¸É¸öСÇøÓò½øÐÐÊý¾Ý´¦Àí¡£
P.S. ÕâÀïÕæÊÇÌå»áµ½ÁËÒ»¸öºÃµÄÃüÃûµÄÁ¦Á¿£¬Group By´Ó×ÖÃæÊÇÖ±½ÓÈ¥Àí½âÊǷdz£ºÃÀí½âµÄ¡£¶÷£¬ÒÔºóÔÚÃü ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ