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

SQLÁ·Ï°

father±í   son±í    
fid fname   sid sname fid height money
1 a   100 s1 1 1.7 7000
2 b   101 s2 2 1.6 8000
3 c   102 s3 2 1.8 9000s
create table father(
fid number primary key,
fname varchar(10)
);
create table son(
sid number primary key,
sname varchar(10),
fid number,
height number,
money number
);
select t.*, t.rowid from father t;
select t.*, t.rowid from son t;
1¡¢²éѯsid¡¢sname¡¢fid  
select sid,sname,fid from son;
     
2¡¢²éѯ¸÷¶ù×ÓÕǼÛ20%ÒÔºóµÄÐÂѧ·Ñ,×¢Òâ,8000¿éÒÔϵIJ»ÕǼۡ£
select money*1.2 as new_money from son where money>=8000
union all
select money from son where money<8000;
select 'ÕÇÁË' as ÕǼÛÇé¿ö,money*1.2 as new_money from son where money>=8000
union all
select 'ûÕÇ',money from son where money<8000;
select money,money*1.2 as new_money from son where money>=8000
union all
select money,null from son where money<8000;
select son.*,(case when money<8000 then money
               when money>=8000 then money*1.2 end)as new_money
from son;
              
--º¯Êý
create or replace function f_get_new_money(p_money son.money%type)
return number
as
begin
  if(p_money>=8000)then
    return p_money*1.2;
  else
    return p_money;
  end if;
end;
select son.*,scott.f_get_new_money(money) as new_money from son;
--Ò»Ìâ¶à½â£¬ÏÂÃæµÄÌâÄ¿Ò²ÊÇ°´ÕÕÕâÖÖ˼·£¨1.ÓÃSQL 2.Èç¹û×ö²»À´£¬Óú¯ÊýÒ»¶¨¿ÉÒÔ£©
     
3¡¢²éѯsid¡¢sname¡¢fname¡£  
--Óï·¨  from t1 join t2 on t1.id=t2.id
SELECT s.sid,s.sname,f.fname
from father f JOIN son s ON f.fid=s.fid; 


Ïà¹ØÎĵµ£º

JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,Oracle

import java.sql.*;
/*
* JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,OracleÊý¾Ý¿â
*
* */
public class JDBC {
  
public static void main(String[] args)throws Exception {
  
   Connection conn=null;
  
       //====Á¬½ÓACCESSÊý¾Ý¿â ......

aspµ÷ÓÃsql server´æ´¢¹ý³Ì

ASPµ÷Óô洢¹ý³ÌµÄ·½·¨£º    
 
----  ¡¡¡¡µ÷Óô洢¹ý³ÌµÄ·½·¨ÐèҪʹÓÃADOµÄCommand¶ÔÏó¡£Command¶ÔÏóÊǶÔÒ»¸öÊý¾ÝÔ´ÔËÐÐÌض¨ÃüÁîµÄ¶¨Ò壨ÀýÈ磬һ¸öSQL²éѯ»òÒ»¸öSQL´æ´¢¹ý³Ì£©¡£ÏÂÃæÒÔMS  SQL  SERVER6.5Ϊºǫ́Êý¾Ý¿â£¬½éÉÜASPµ÷Óô洢¹ý³ÌµÄ·½·¨¡£    
 
----  ¡ ......

SQL Server Óû§¶¨ÒåµÄº¯Êý


·¢²¼ÈÕÆÚ : 1/14/2005 | ¸üÐÂÈÕÆÚ : 1/14/2005
John Papa
Óû§¶¨ÒåµÄº¯Êý (UDF) ÊÇ×¼±¸ºÃµÄ´úÂëƬ¶Î£¬Ëü¿ÉÒÔ½ÓÊܲÎÊý£¬´¦ÀíÂß¼­£¬È»ºó·µ»ØijЩÊý¾Ý¡£¸ù¾Ý SQL Server Books Online£¬SQL Server™ 2000 ÖÐµÄ UDF ¿ÉÒÔ½ÓÊÜ´Ó 0 µ½ 1024 µÄÈÎÒâ¸öÊýµÄ²ÎÊý£¬²»¹ýÎÒ±ØÐë³ÐÈÏ£¬ÎÒ»¹Î´³¢ÊÔ½« 1024 ¸ö²ÎÊý´«µÝµ½ UDF ÖС£ ......

sqlÀàÐÍת»»º¯ÊýcastºÍconvert

¼ò½é£º
        Êý¾ÝÀàÐÍת»»¿ÉÒÔͨ¹ýCAST()ºÍCONVERT()º¯ÊýÀ´ÊµÏÖ¡£´ó¶àÊýÇé¿öÏ£¬ÕâÁ½¸öº¯ÊýÊÇÖصþµÄ£¬ËüÃÇ·´Ó³ÁËSQLÓïÑÔµÄÑÝ»¯ÀúÊ·¡£ÕâÁ½¸öº¯ÊýµÄ¹¦ÄÜÏàËÆ£¬²»¹ýËüÃǵÄÓï·¨²»Í¬¡£ËäÈ»²¢·ÇËùÓÐÀàÐ͵ÄÖµ¶¼ÄÜת±äΪÆäËûÊý¾ÝÀàÐÍ£¬µ«×ܵÄÀ´Ëµ£¬ÈκοÉÒÔת»»µÄÖµ¶¼¿ÉÒÔÓüòµ¥µÄº¯ÊýʵÏÖ× ......

Oracle Sql Óï¾äÐÔÄܵ÷ÓÅ

ÕâƪÎÄÕÂÊÇÐþ»úÒÝʿΪijÉÏÊй«Ë¾µÄERPϵͳµ÷ÓÅËù׫д±¨¸æµÄ²¿·Öժ¼£¬Ï£ÍûÄܹ»¶Ô´ó¼ÒÓÐËù°ïÖú£º
ÏÂÃæ¸ø³öSQLÓÅ»¯¾­³£Óöµ½µÄÇéÐΡ£ËüÃÇÊÇÔںܶàÈ˳¤ÆÚ»ýÀ۵ľ­ÑéÉÏ×ܽá³öÀ´µÄ£¬ÕâЩ¶¼ÊÇһЩһ°ãÐԵĽáÂÛ£¬ÔÚʵ¼Ê¹¤×÷ÖУ¬»¹Ó¦µ±¾ßÌåÇé¿ö¾ßÌå·ÖÎö£¬²¢¼ÓÒÔÁé»îÔËÓá£
(1)  ÓÃNOT EXISTSÌæ»»NOT IN ½«¸üÏÔÖøµØÌá¸ßЧÂÊ£¬¾ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ