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

SQL, sql server 2000 ,±í¼äÊý¾Ý ,¼¶Áª¸üÐÂɾ³ý

Èç¹û£¬ÏÖÔÚÓÐÁ½ÕűíA(id,xx.xx...),C(id,Cid,xx,xx...)£¬Ô¤ÊµÏÖCÖеÄidÓëA ÖÐid¼¶ÁªÉ¾³ý¡¢¼¶Áª¸üÐÂ/Êý¾Ýͬ²½£¬¿ÉÓÐÁ½ÖÖʵÏÖ·½Ê½£º
Ò».
ÀûÓÃsql server×Ô´øµÄ¼¶ÁªÉ¾³ý¡¢¼¶Áª¸üй¦ÄÜ£¬¼´ÆäÍâ¼üÔ¼Êø;¾¶
 
 
alter table dbo.C
add constraint FK_C_A_AID
foreign key(AID) references dbo.A(AID)
on delete cascade
on update casade
go
 
 
alter table dbo.C
add constraint FK_C_B_BID
foreign key(BID) references dbo.B(BID)
on delete cascade
on update casade
go
 
 
 
 
 
¼¶Áª¸üкͼ¶ÁªÉ¾³ý·½Ê½£º
Alter TABLE [dbo].[T_USERGROUP] ADD
        CONSTRAINT [FK_T_USERGROUP_T_ACCTTEMPLATE] FOREIGN KEY
        (
                [ATNAME]
        ) REFERENCES [dbo].[T_ACCTTEMPLATE] (
                [ATNAME]
        ) ON Update CASCADE ON Delete CASCADE
 
 
¶þ¡¢ÁíÍ⣬ÎÒÃÇÒ²ÍêÈ«¿ÉÒÔ×ÔÒÑдһ¸ö´¥·¢Æ÷À´ÊµÏִ˹¦ÄÜ
 
    
    
     A:
 
     int id
     varchar(20) name
    
     C:
     int id
     int Cid
     varchar(100) info
 
     ¼ÙÉè±íA¡¢CµÄ×Ö¶ÎÈçÉÏ£º
 
     ÈçÒÔ¼¶ÁªÉ¾³ý±íA¡¢C¼Ç¼ΪÀý£¬ÊµÏÖÓï¾äÈçÏ£º
     (Èç¹ûɾ³ý±íAÖеļǼ£¬Ôò×Ô¶¯É¾³ý±íCÖÐÓë±íAÖÐidÏàͬµÄ¼Ç¼)
 
    CREATE   TRIGGER trg_a
ON A
FOR INSERT,UPDATE,DELETE
AS
BEGIN
              DECLARE @nInsRows   INT   --ÓÃÓÚ²åÈë¼Ç¼ÌõÊýͳ¼Æ
    &n


Ïà¹ØÎĵµ£º

dz̸SQL×¢Èë µ±unionÓöÉÏntextÊý¾ÝÀàÐÍ

      ÔÚÎÒÃǽøÐÐsql×¢ÈëµÄ¹ý³ÌÖг£³£»áÓõ½union²éѯ·½·¨£¬´ó¶àÊýÇé¿öÏÂʹÓÃunion²éѯ·¨¿ÉÒÔÈÃÎÒÃǺܿìµÄÖªµÀÄ¿±êµÄÊý¾Ý×éÖ¯·½Ê½¡£È»¶øµ±ÎÒÃÇÓöµ½ntext¡¢text»òimageÊý¾ÝÀàÐÍʱ£¬union²éѯ¾Í²»Ì«¹ÜÓÃÁË¡£ÒÔsql serverΪÀý£¬ÔÚÕâÖÖÇé¿öÏ»áÅ׳öÈçÏ´íÎó£ºntext Êý¾ÝÀàÐͲ»ÄÜѡΪ DISTINCT£¬ÒòΪËü ......

Oracle PL/SQLÖÐÈçºÎʹÓÃ%TYPEºÍ%ROWTYPE

¡¡
¡¡¡¡1. ʹÓÃ%TYPE
¡¡¡¡ÔÚÐí¶àÇé¿öÏ£¬PL/SQL±äÁ¿¿ÉÒÔÓÃÀ´´æ´¢ÔÚÊý¾Ý¿â±íÖеÄÊý¾Ý¡£ÔÚÕâÖÖÇé¿öÏ£¬±äÁ¿Ó¦¸ÃÓµÓÐÓë±íÁÐÏàͬµÄÀàÐÍ¡£ÀýÈ磬students±íµÄfirst_nameÁеÄÀàÐÍΪVARCHAR2(20),ÎÒÃÇ¿ÉÒÔ°´ÕÕÏÂÊö·½Ê½ÉùÃ÷Ò»¸ö±äÁ¿£º
¡¡¡¡DECLARE
¡¡¡¡ v_FirstName VARCHAR2(20);
¡¡
¡¡µ«ÊÇÈç¹ûfirst_nameÁеĶ¨Òå¸Ä±äÁ ......

mysql+phpÎÞ·¨Á¬½Ósql£¨Òѽâ¾ö£©

¸ãÁ˺ܾᣡ£ÖÕÓÚ·¢ÏÖÔ­À´ÊÇȨÏÞÎÊÌâ¡£¡£
2ÐÐÃüÁî¸ã¶¨
grant all privileges on rogue.* to admin@localhost identified by 'admin' with grant option
grant all privileges on rogue.* to admin@'%' identified by 'admin' with grant option
¾­µäÁË¡£¡£¡£
ħÁ¦Ë½·þÍøÒ³¶Ë¸ã¶¨¿©~~ ......

SQL´æ´¢¹ý³ÌÈëÃÅ

SQL´æ´¢¹ý³ÌÈëÃÅ
 
Ò»¡¢SQL´æ´¢¹ý³ÌµÄ¸ÅÄÓŵ㼰Óï·¨
¡¡¡¡ÕûÀíÔÚѧϰ³ÌÐò¹ý³Ì֮ǰ£¬ÏÈÁ˽âÏÂʲôÊÇ´æ´¢¹ý³Ì?ΪʲôҪÓô洢¹ý³Ì£¬ËûÓÐÄÇЩÓŵã
¡¡¡¡¶¨Ò壺½«³£ÓõĻòºÜ¸´ÔӵŤ×÷£¬Ô¤ÏÈÓÃSQLÓï¾äдºÃ²¢ÓÃÒ»¸öÖ¸¶¨µÄÃû³Æ´æ´¢ÆðÀ´, ÄÇôÒÔºóÒª½ÐÊý¾Ý¿âÌṩÓëÒѶ¨ÒåºÃµÄ´æ´¢¹ý³ÌµÄ¹¦ÄÜÏàͬµÄ·þÎñʱ,Ö»Ðèµ÷ÓÃexecute ......

SQL´æ´¢¹ý³ÌʵÀý


Àý1 ´«ÈëÒ»¸ö²ÎÊý@username,ÅжÏÓû§ÊÇ·ñ´æÔÚ
-------------------------------------------------------------------------------
CREATE PROC IsExistUser
(
@username varchar(20),
@IsExistTheUser varchar(25) OUTPUT--Êä³ö²ÎÊý
)
as
SELECT @IsExistTheUser = count(username)
from users
WHERE username ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ