[SQL]´æ´¢¹ý³ÌµÄʹÓÃ
1.ÔÚmssql´´½¨´æ´¢¹ý³Ì,ÔÚdb->´æ´¢¹ý³Ì->н¨´æ´¢¹ý³Ì(ÓÒ¼ü)
CREATE PROCEDURE user_logon_check @username varchar(45),@userpsw varchar(45)
AS
select * from users where UserName = @username and PasswordCode = @userpsw
return 10
GO
2.ÔÚmysql´´½¨´æ´¢¹ý³Ì,ʹÓÃMysql Query Browser,ÔÚdb->±íÃû->Create New Procedure/Function(ÓÒ¼ü)
DELIMITER \\
DROP PROCEDURE IF EXISTS `test`.`user_logon_check`\\
CREATE PROCEDURE `user_logon_check`(in username varchar(45),IN userpsw varchar(45))
BEGIN
SELECT * from test where name = username and psw = userpsw;
END\\
DELIMITER ;
×¢Ò⽫ $$ -> \\
Ïà¹ØÎĵµ£º
Insert Into Êý¾Ý±íÃû³Æ(×Ö¶ÎÃû³Æ1,×Ö¶ÎÃû³Æ2,...) values(×Ö¶ÎÖµ1,×Ö¶ÎÖµ2,...)
insert into user(username,password,age) values('ÀîÀÏËÄ','6666',45)
Update Êý¾Ý±íÃû³Æ Set ×Ö¶ÎÃû³Æ=×Ö¶ÎÖµ,×Ö¶ÎÃû³Æ=×Ö¶ÎÖµ,...[Where Ìõ¼þ]
Delete from Êý¾Ý±í
ÏÂÁвéѯ·µ»ØÔÚLONDON£¨Â×¶Ø£©»òSEATTLE£¨Î÷ÑÅͼ£©µÄËùÓйÍÔ±£º
S ......
1 Âß¼Êý¾Ý¿âºÍ±íµÄÉè¼Æ
Êý¾Ý¿âµÄÂß¼Éè¼Æ¡¢°üÀ¨±íÓë±íÖ®¼äµÄ¹ØÏµÊÇÓÅ»¯¹ØÏµÐÍÊý¾Ý¿âÐÔÄܵĺËÐÄ¡£Ò»¸öºÃµÄÂß¼Êý¾Ý¿âÉè¼Æ¿ÉÒÔΪ
ÓÅ»¯Êý¾Ý¿âºÍÓ¦ÓóÌÐò´òÏÂÁ¼ºÃµÄ»ù´¡¡£
±ê×¼»¯µÄÊý¾Ý¿âÂß¼Éè¼Æ°üÀ¨ÓöàµÄ¡¢ÓÐÏ໥¹ØÏµµÄÕ±íÀ´´úÌæºÜ¶àÁеij¤Êý¾Ý±í¡£ÏÂÃæÊÇһЩʹÓñê×¼»¯
±íµÄһЩºÃ´¦¡£
A:ÓÉÓÚ±íÕ£¬Òò´Ë¿ÉÒÔʹŠ......
±ÜÃâʹÓÃIN ²Ù×÷·û
ÓÃINд³öÀ´µÄSQLµÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ×¶®£¬Õâ±È½ÏÊʺÏÏÖ´úÈí¼þ¿ª·¢µÄ·ç¸ñ¡£
µ«ÊÇÓÃINµÄSQLÐÔÄÜ×ÜÊDZȽϵ͵쬴ÓORACLEÖ´ÐеIJ½ÖèÀ´·ÖÎöÓÃINµÄSQLÓë²»ÓÃINµÄSQLÓÐÒÔÏÂÇø±ð£º
¡¡ORACLEÊÔͼ½«Æäת»»³É¶à¸ö±íµÄÁ¬½Ó£¬Èç¹ûת»»²»³É¹¦ÔòÏÈÖ´ÐÐINÀïÃæµÄ×Ó²éѯ£¬ÔÙ²éѯÍâ²ãµÄ±í¼Ç ......
Select TOP N * from TABLE Order By NewID()
--Access£º
Select TOP N * from TABLE Order By Rnd(ID)
Rnd(ID) ÆäÖеÄIDÊÇ×Ô¶¯±àºÅ×ֶΣ¬¿ÉÒÔÀûÓÃÆäËûÈκÎÊýÖµÀ´Íê³É£¬±ÈÈçÓÃÐÕÃû×Ö¶Î(UserName)
Selec ......
1. ´´½¨´¥·¢Æ÷, ÔÚmssqlϵĴ¥·¢Æ÷µÄʹÓÃ:Db->±í->Ñ¡Ôñ±íÃû->ËùÓÐÈÎÎñ(ÓÒ¼ü)->¹ÜÀí´¥·¢Æ÷
2. µ±±í±»¸üÐÂ\²åÈë\ɾ³ýºó,¶¼¿ÉÒÔͨ¹ý¶¨Òå´¥·¢Æ÷À´ÏìÓ¦¸Ãʼþ,´Ó¶ø½øÐÐÏàÓ¦µÄ´¦Àí! ÈçÒ»¸öѧÉúתϵÁË,ÆäѧºÅ±»¸ü»»ÁË,ËûËù½èµÄͼÊé¶ÔÓ¦µÄѧºÅÒ²ÏàÓ¦ÐèÒª¸Ä¶¯,Õâ¸öÎÒÃÇ¿ÉÒÔֻͨ¹ýupdateÆäѧºÅ,ºÍѧºÅÏà¹ØÁªµÄ±íÓÉ´¥·¢Æ÷ ......