mysql´æ´¢¹ý³Ì ¸³Öµ
IN expireDate VARCHAR(20),IN resType INT
//-----------------------------------------------------------------------------------
BEGIN
DECLARE a,b,icon_id INT;
DECLARE cur_1 CURSOR FOR SELECT id from `tbl_resource` WHERE discriminator="RC_CON" and robot_type=resType and add_date<=expireDate;/*robot_type ´úÌæ×ÊÔ´ÀàÐÍ*/
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET b = 1;
OPEN cur_1;
REPEAT
FETCH cur_1 INTO a;
SELECT smallIcon INTO icon_id from tbl_resource WHERE id=a; /*µÃµ½ËõÂÔͼƬµÄid*/
DELETE from `tbl_resource` WHERE parent_id=a; /*ɾ³ýÕâ¸öcontentËùº¬µÄ×ÊÔ´*/
DELETE from `tbl_visitrecords` WHERE resource_id=a; /*ɾ³ý·ÃÎÊÐÅÏ¢*/
DELETE from `tbl_detailrecord` WHERE resource_id=a; /*ɾ³ÇÏéϸ·ÃÎÊÐÅÏ¢ */
DELETE from `tbl_comment` WHERE resource_id=a; /*ɾ³ÇÏà¹ØÆÀÂÛ*/
DELETE from `tbl_resource` WHERE id=a; /*ɾ³Ç×Ô¼º*/
IF icon_id >0 THEN
DELETE from `tbl_resource` WHERE id=icon_id; /*ɾ³ýͼ±ê*/
/*SELECT "ɾ³ýÁË"+icon_id;*/
END IF;
UNTIL b = 1
END REPEAT;
CLOSE cur_1;
/*SELECT count(id) from `tbl_resource` WHERE discriminator="RC_CON" and robot_type=0 and add_date<=expireDate;*/
END
//Ïà¹ØÓï·¨
if Null is Null then
SELECT 23;
else
SELECT 45;
end IF;
//¸³Öµ
select @cnt := count(1) from tablenmae
ºÍ
select count(1) into @cnt from tablename
ÊÇµÈ¼ÛµÄ ¡£
Ïà¹ØÎĵµ£º
×î½ü¹¤×÷Éϳ£Óõ½MySQL£¬·¢ÏÖMySQLµÄ´íÎóÌáʾÒô±È½Ï·³ÈË£¬ÉÏÍøËÑË÷ÁËһϣ¬ÓÐÒÔÏÂÈýÖֹرոÃÌáʾÒôµÄ·½·¨£º
·½·¨1. ʹÓÃÖÕ¶ËÃüÁî
ʹÓÃMySQLµÄÃüÁîÖÕ¶Ëʱ£¬Ê¹ÓÃmysql --no-beep¼´¿É¡£
·½·¨2. ÐÞ¸ÄMySQLÅäÖÃÎļþmy.ini
ÔÚ[mysql] ϼÓÈëÒ»ÐÐ
no-beep
&nb ......
ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]
alter_specification:
ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
or ADD INDEX [index_name] (index_col_name,...)
or ADD PRIMARY KEY (index_col_name,...)
or ADD UNIQUE [index_name] (index_col_name,...)
or ALTER [ ......
1.¸´ÖƱí½á¹¹¼°Êý¾Ýµ½Ð±í
CREATE TABLE бí SELECT * from ¾É±í
2.Ö»¸´ÖƱí½á¹¹µ½Ð±í
CREATE TABLE бí SELECT * from ¾É±í WHERE 1=2
»òCREATE TABLE бí LIKE ¾É±í
3.¸´ÖƾɱíµÄÊý¾Ýµ½Ð±í(¼ÙÉèÁ½¸ö±í½á¹¹Ò»Ñù)
INSERT INTO бí SELECT * from ¾É±í
4.¸´ÖƾɱíµÄÊý¾Ýµ½Ð±í(¼ÙÉèÁ½¸ö±í½á¹¹²»Ò»Ñù)
IN ......
ÒýÓÃhttp://bbs.yahunet.com/thread-9946-1-1.html
´Ó»ù±¾Çé¿ö¡¢³É±¾¡¢ÓÅȱµãºÍÓ¦Óó¡ºÏµÈ·½Ãæ¶Ô5ÖÖMySQLµÄ¿É¿¿ÐÔ·½°¸
½øÐÐÁË·ÖÎö
ºÍ±È½Ï£¬¶ÔMySQLµÄ¿ª·¢ºÍ¹ÜÀí
ÓÐÒ»¶¨µÄ½è¼ø×÷Óá£
1£®MySQL Clustering(ndb-cluster stogare)
¼ò½é£º
MySQL¹«Ë¾ÒÔ´æ´¢ÒýÇ淽ʽÌṩµÄ¸ß¿É¿¿ÐÔ·½°¸£¬ÊÇÊÂÎñ°²È«µÄ£¬ÊµÊ±¸´ÖÆÊý¾Ý
£¬¿ÉÓ ......