mysqlÈÕÆÚºÍʱ¼ä¸ñʽת»»
¶ÔÓÚÿ¸öÀàÐÍÓµÓеÄÖµ·¶Î§ÒÔ¼°²¢ÇÒÖ¸¶¨ÈÕÆÚºÎʱ¼äÖµµÄÓÐЧ¸ñʽµÄÃèÊö¼û7.3.6 ÈÕÆÚºÍʱ¼äÀàÐÍ¡£
ÕâÀïÊÇÒ»¸öʹÓÃÈÕÆÚº¯ÊýµÄÀý×Ó¡£ÏÂÃæµÄ²éѯѡÔñÁËËùÓмǼ£¬Æädate_colµÄÖµÊÇÔÚ×îºó30ÌìÒÔÄÚ£º
mysql> SELECT something from table
WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;
DAYOFWEEK(date)
·µ»ØÈÕÆÚdateµÄÐÇÆÚË÷Òý(1=ÐÇÆÚÌ죬2=ÐÇÆÚÒ», ……7=ÐÇÆÚÁù)¡£ÕâЩË÷ÒýÖµ¶ÔÓ¦ÓÚODBC±ê×¼¡£
mysql> select DAYOFWEEK('1998-02-03');
-> 3
WEEKDAY(date)
·µ»ØdateµÄÐÇÆÚË÷Òý(0=ÐÇÆÚÒ»£¬1=ÐÇÆÚ¶þ, ……6= ÐÇÆÚÌì)¡£
mysql> select WEEKDAY('1997-10-04 22:23:00');
-> 5
mysql> select WEEKDAY('1997-11-05');
-> 2
DAYOFMONTH(date)
·µ»ØdateµÄÔ·ÝÖÐÈÕÆÚ£¬ÔÚ1µ½31·¶Î§ÄÚ¡£
mysql> select DAYOFMONTH('1998-02-03');
-> 3
DAYOFYEAR(date)
·µ»ØdateÔÚÒ»ÄêÖеÄÈÕÊý, ÔÚ1µ½366·¶Î§ÄÚ¡£
mysql> select DAYOFYEAR('1998-02-03');
-> 34
MONTH(date)
·µ»ØdateµÄÔ·ݣ¬·¶Î§1µ½12¡£
mysql> select MONTH('1998-02-03');
-> 2
DAYNAME(date)
·µ»ØdateµÄÐÇÆÚÃû×Ö¡£
mysql> select DAYNAME("1998-02-05");
-> 'Thursday'
MONTHNAME(date)
·µ»ØdateµÄÔ·ÝÃû×Ö¡£
mysql> select MONTHNAME("1998-02-05");
-> 'February'
QUARTER(date)
·µ»ØdateÒ»ÄêÖеļ¾¶È£¬·¶Î§1µ½4¡£
mysql> select QUARTER('98-04-01');
-> 2
WEEK(date)
¡¡
WEEK(date,first)
¶ÔÓÚÐÇÆÚÌìÊÇÒ»ÖܵĵÚÒ»ÌìµÄµØ·½£¬ÓÐÒ»¸öµ¥¸ö²ÎÊý£¬·µ»ØdateµÄÖÜÊý£¬·¶Î§ÔÚ0µ½52¡£2¸ö²ÎÊýÐÎʽWEEK()ÔÊÐí
ÄãÖ¸¶¨ÐÇÆÚÊÇ·ñ¿ªÊ¼ÓÚÐÇÆÚÌì»òÐÇÆÚÒ»¡£Èç¹ûµÚ¶þ¸ö²ÎÊýÊÇ0£¬ÐÇÆÚ´ÓÐÇÆÚÌ쿪ʼ£¬Èç¹ûµÚ¶þ¸ö²ÎÊýÊÇ1£¬
´ÓÐÇÆÚÒ»¿ªÊ¼¡£
mysql> select WEEK('1998-02-20');
-> 7
mysql> select WEEK('1998-02-20',0);
-> 7
mysql> select WEEK('1998-02-20',1);
-> 8
YEAR(date)
·µ»ØdateµÄÄê·Ý£¬·¶Î§ÔÚ1000µ½9999¡£
mysql> select YEAR('98-02-03');
-> 1998
HOUR(time)
·µ»ØtimeµÄСʱ£¬·¶Î§ÊÇ0µ½23¡£
mysql> select HOUR('10:05:03');
-> 10
MINUTE(time)
·µ»ØtimeµÄ·ÖÖÓ£¬·¶Î§ÊÇ0µ½59¡£
mysql> select MINUTE('98-02-03 10:05:03');
-> 5
SECOND(time)
»ØÀ´timeµÄÃë
Ïà¹ØÎĵµ£º
Õª³×Ô£ºhttp://database.ctocio.com.cn/153/9232653.shtml
ºÜ¶àʱºò¹ØÐĵÄÊÇÓÅ»¯SELECT ²éѯ£¬ÒòΪËüÃÇÊÇ×î³£ÓõIJéѯ£¬¶øÇÒÈ·¶¨ÔõÑùÓÅ»¯ËüÃDz¢²»×ÜÊÇÖ±½ØÁ˵±¡£Ïà¶ÔÀ´Ëµ£¬½«Êý¾Ý×°ÈëÊý¾Ý¿âÊÇÖ±½ØÁ˵±µÄ¡£È»¶ø£¬Ò²´æÔÚ¿ÉÓÃÀ´¸ÄÉÆÊý¾Ý×°ÔزÙ×÷ЧÂʵIJßÂÔ£¬Æä»ù±¾ÔÀíÈçÏ£º
¡¡¡¡³ÉÅú×°Ôؽϵ¥ÐÐ×°Ôظü¿ì£¬ÒòΪÔÚ×°ÔØÿ¸ö¼Ç ......
MySql ×Ö·û´®º¯Êý
[ 2006-04-22 19:24:44 | Author: Ychon ]
Font Size: Large | Medium | Small
¶ÔÓÚÕë¶Ô×Ö·û´®Î»ÖõIJÙ×÷£¬µÚÒ»¸öλÖñ»±ê¼ÇΪ1¡£
ASCII(str)
·µ»Ø×Ö·û´®strµÄ×î×óÃæ×Ö·ûµÄASCII´úÂëÖµ¡£Èç¹ûstrÊÇ¿Õ×Ö·û´®£¬·µ»Ø0¡£Èç¹ûstrÊÇNULL£¬·µ»ØNULL¡£
mysql> select ASCII('2');
-> 50
mysql ......
ÎÒÒ»Ö±ÊÇʹÓÃmysqlÕâ¸öÊý¾Ý¿âÈí¼þ£¬Ëü¹¤×÷±È½ÏÎȶ¨£¬Ð§ÂÊÒ²ºÜ¸ß¡£ÔÚÓöµ½ÑÏÖØÐÔÄÜÎÊÌâʱ£¬Ò»°ã¶¼ÓÐÕâô¼¸ÖÖ¿ÉÄÜ£º
1¡¢Ë÷ÒýûÓн¨ºÃ£»
2¡¢sqlд·¨¹ýÓÚ¸´ÔÓ£»
3¡¢ÅäÖôíÎó£»
4¡¢»úÆ÷ʵÔÚ¸ººÉ²»ÁË£»
1¡¢Ë÷ÒýûÓн¨ºÃ
Èç¹û¿´µ½mysqlÏûºÄµÄcpuºÜ´ó£¬¿ÉÒÔÓÃmysqlµÄclient¹¤¾ßÀ´¼ì²é¡£
ÔÚlinuxÏÂÖ´ÐÐ
/usr/local/mysql/bin/ ......
ÔÚMySQL 3.23.44°æ±¾ºó£¬InnoDBÒýÇæÀàÐ͵ıíÖ§³ÖÁËÍâ¼üÔ¼Êø¡£
Íâ¼üµÄʹÓÃÌõ¼þ£º
1.Á½¸ö±í±ØÐëÊÇInnoDB±í£¬MyISAM±íÔÝʱ²»Ö§³ÖÍâ¼ü£¨¾Ý˵ÒÔºóµÄ°æ±¾ÓпÉÄÜÖ§³Ö£¬µ«ÖÁÉÙÄ¿Ç°²»Ö§³Ö£©£»
2.Íâ¼üÁбØÐ뽨Á¢ÁËË÷Òý£¬MySQL 4.1.2ÒÔºóµÄ°æ±¾ÔÚ½¨Á¢Íâ¼üʱ»á×Ô¶¯´´½¨Ë÷Òý£¬µ«Èç¹ûÔÚ½ÏÔçµÄ°æ±¾ÔòÐèÒªÏÔʾ½¨Á¢£»
3.Íâ¼ü¹ØÏ ......
ÔÚwindowsÏÂ
£º
Æô¶¯£º
1.cd c:\mysql\bin
2.mysqld --console
¹Ø±Õ£º
1.cd c:\mysql\bin
......