MySql ÅжϺº×Ö¡¢ÈÕÆÚ¡¢Êý×ֵĺ¯Êý
¼¸¸öƽ³£ÓõÄmysqlº¯Êý
/*****************************************************
1.ÅжÏ×Ö·û´®ÊÇ·ñΪºº×Ö ·µ»ØÖµ£º1-ºº×Ö 0-·Çºº×Ö
*****************************************************/
DROP FUNCTION IF EXISTS fc_is_hanzi;
CREATE FUNCTION fc_is_hanzi(
p_str VARCHAR(1024)
)
RETURNS int(11)
NOT DETERMINISTIC
SQL SECURITY DEFINER
COMMENT '¼ì²é×Ö·û´®ÊÇ·ñΪºº×Ö'
BEGIN
/*¼ì²é×Ö·û´®ÊÇ·ñΪºº×Ö ·µ»ØÖµ£º1-ºº×Ö 0-·Çºº×Ö*/
DECLARE _ret, i, other_cnt, l_acode INT DEFAULT 0;
SET _ret = 0;
SET i = 1;
SET other_cnt = 0;
SET l_acode = 0;
WHILE i <= CHAR_LENGTH(p_str) DO
SET l_acode = ASCII(SUBSTRING(p_str, i, 1));
IF l_acode<124 or l_acode>254 THEN
SET other_cnt = other_cnt + 1;
END IF;
SET i = i + 1;
END WHILE;
IF other_cnt = 0 THEN
SET _ret = 1;
ELSE
SET _ret = 0;
END IF;
RETURN _ret;
END;
/*****************************************************
2.ÅжÏÈÕÆÚ¸ñʽÊÇ·ñÕýÈ·£¨·µ»ØÖµ£º1-ÕýÈ· 0-´íÎó£©
*****************************************************/
DROP FUNCTION IF EXISTS fc_ck_date;
CREATE FUNCTION fc_ck_date(
p_cont CHAR(32)
)
RETURNS tinyint(4)
NOT DETERMINISTIC
SQL SECURITY DEFINER
COMMENT 'Åж¨ÈÕÆÚ¸ñʽÊÇ·ñÕýÈ·'
BEGIN
/*Åж¨ÈÕÆÚ¸ñʽÊÇ·ñÕýÈ·£¨·µ»ØÖµ£º1-ÕýÈ· 0-´íÎó£©*/
/*ÊäÈëÖµ¸ñʽΪ£ºyyyyMMdd »ò yyyy-MM-dd*/
IF(SELECT DATE_FORMAT(p_cont
Ïà¹ØÎĵµ£º
mysql³ö´íÁË,ÒÔÇ°ÍùÍù¿¿²Â.ÓÐÁËÕâÕűí,Ò»²é¾Í³öÀ´ÁË.·½±ã²»ÉÙ.Ìع²ÏíÓÚÖÚ
1005£º´´½¨±íʧ°Ü
1006£º´´½¨Êý¾Ý¿âʧ°Ü
1007£ºÊý¾Ý¿âÒÑ´æÔÚ£¬´´½¨Êý¾Ý¿âʧ°Ü
1008£ºÊý¾Ý¿â²»´æÔÚ£¬É¾³ýÊý¾Ý¿âʧ°Ü
1009£º²»ÄÜɾ³ýÊý¾Ý¿âÎļþµ¼ÖÂɾ³ýÊý¾Ý¿âʧ°Ü
1010£º²»ÄÜɾ³ýÊý¾ÝĿ¼µ¼ÖÂɾ³ýÊý¾Ý¿âʧ ......
Ò»¡¢²ÎÕÕÍêÕûÐÔ(Referential integrity)ºÍÍâ¼ü(foreign key)
²ÎÕÕÍêÕûÐÔ(Referential integrity)ÊÇÓÃÓÚÔ¼¶¨Á½¸ö¹Øϵ֮¼äµÄÁªÏµ£¬ÀíÂÛÉϹ涨£ºÈôMÊǹØϵSÖеÄÒ»ÊôÐÔ×飬ÇÒMÊÇÁíÒ»¹ØϵZµÄÖ÷¹Ø¼ü×Ö£¬Ôò³ÆMΪ¹ØϵS¶ÔÓ¦¹ØϵZµÄÍâ¹Ø¼ü×Ö¡£ÈôMÊǹØϵSµÄÍâ¹Ø¼ü×Ö£¬ÔòSÖÐÿһ¸öÔª×éÔÚMÉϵÄÖµ±ØÐëÊÇ¿ÕÖµ»òÊǶÔÓ¦¹ØϵZÖÐij¸öÔª×éµÄÖ÷¹ ......
lect ASIN('foo');
¡¡¡¡-> 0.000000
ATAN(N)
¡¡·µ»ØNµÄ·´ÕýÇÐÖµ
mysql> select ATAN(2);
¡¡¡¡-> 1.107149
mysql> select ATAN(-2);
¡¡¡¡-> -1.107149
ATAN2(X,Y)
¡¡·µ»Ø2¸ö±äÁ¿XºÍYµÄ·´ÕýÇÐ(ÀàËÆY/XµÄ·´ÕýÇÐ,·ûºÅ¾ö¶¨ÏóÏÞ)
mysql> select ATAN(-2,2);
¡¡¡¡-> -0.785398
mysql> ......
¼ÇÏÂЩlinuxÏÂmysqlµÄ²Ù×÷£¬ÒÔ±ãÒÔºó²é¿´£º
1. Æô¶¯£¬¹Ø±Õmysql£º
Æô¶¯£ºsudo /etc/init.d/mysql start
¹Ø±Õ£º/usr/bin/mysqladmin -uroot -p shutdown
2.ÏÔʾ ±í½á¹¹£º
describe:tableName
3.±¸·Ý£º
Ö»±¸·Ý±í½á¹¹£ºmysqldump -d -uroot -p DataBase TableName> xxx.sql
±¸·Ý±í½á¹¹ºÍÊý¾Ý£ºmysqldump -uro ......
¼¸¸öƽ³£ÓõÄmysqlº¯Êý
/*****************************************************
1.ÅжÏ×Ö·û´®ÊÇ·ñΪºº×Ö ·µ»ØÖµ£º1-ºº×Ö 0-·Çºº×Ö
*****************************************************/
DROP FUNCTION IF EXISTS fc_is_hanzi;
CREATE FUNCTION fc_is_hanzi(
p_str VARCHAR(1024)
)
......