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

MysqlµÄÈÕÆÚºÍʱ¼äº¯Êý

ÕâÀïÊÇÒ»¸öʹÓÃÈÕÆÚº¯ÊýµÄÀý×Ó¡£ÏÂÃæµÄ²éѯѡÔñËùÓÐ date_col ÖµÔÚ×îºó 30 ÌìÄڵļǼ¡£
mysql> SELECT something from tbl_name
WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;
DAYOFWEEK(date) ·µ»Ø date µÄÐÇÆÚË÷Òý(1 = Sunday, 2 = Monday, ... 7 = Saturday)¡£Ë÷ÒýÖµ·ûºÏ ODBC µÄ±ê×¼¡£
mysql> SELECT DAYOFWEEK('1998-02-03');
-> 3
WEEKDAY(date) ·µ»Ø date µÄÐÇÆÚË÷Òý(0 = Monday, 1 = Tuesday, ... 6 = Sunday)£º
mysql> SELECT WEEKDAY('1998-02-03 22:23:00');
-> 1
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 µ½ 53 (Êǵģ¬¿ÉÄÜÓÐµÚ 53 ÖܵĿªÊ¼)¡£Á½¸ö²ÎÊýÐÎʽµÄ WEEK() ÔÊÐíÄãÖ¸¶¨Ò»ÖÜÊÇ·ñÒÔÐÇÆÚÈÕ»òÐÇÆÚÒ»¿ªÊ¼£¬ÒÔ¼°·µ»ØֵΪ 0-53 »¹ÊÇ 1-52¡£ ÕâÀïµÄÒ»¸ö±íÏÔʾµÚ¶þ¸ö²ÎÊýÊÇÈçºÎ¹¤×÷µÄ£º
Öµ
º¬Òå
0
Ò»ÖÜÒÔÐÇÆÚÈÕ¿ªÊ¼£¬·µ»ØÖµ·¶Î§Îª 0-53
1
Ò»ÖÜÒÔÐÇÆÚÒ»¿ªÊ¼£¬·µ»ØÖµ·¶Î§Îª 0-53
2
Ò»ÖÜÒÔÐÇÆÚÈÕ¿ªÊ¼£¬·µ»ØÖµ·¶Î§Îª 1-53
3
Ò»ÖÜÒÔÐÇÆÚÒ»¿ªÊ¼£¬·µ»ØÖµ·¶Î§Îª 1-53 (ISO 8601)
mysql> SELECT WEEK('1998-02-20');
-> 7
mysql> SELECT WEEK('1998-02-20',0);
-> 7
mysql> SELECT WEEK('1998-02-20',1);
-> 8
mysql> SELECT WEEK('1998-12-31',1);
-> 53
×¢Ò⣬ÔÚ°æ±¾ 4.0 ÖУ¬WEEK(#,0) ±»¸ü¸ÄΪƥÅä U


Ïà¹ØÎĵµ£º

mysql ÖÐÊýѧº¯ÊýµÄʹÓÃ

ËùÓеÄÊýѧº¯ÊýÔÚÒ»¸ö³ö´íµÄÇé¿öÏ·µ»ØNULL¡£ 

µ¥Ä¿¼õ¡£¸Ä±ä²ÎÊýµÄ·ûºÅ¡£ 
mysql> select - 2; 
×¢Ò⣬Èç¹ûÕâ¸ö²Ù×÷·ûÓëÒ»¸öBIGINTʹÓ㬷µ»ØÖµÊÇÒ»¸öBIGINT£¡ÕâÒâζ×ÅÄãÓ¦¸Ã±ÜÃâÔÚÕûÊýÉÏʹÓÃ-£¬ÄÇ¿ÉÄÜÓÐÖµ-2^63£¡ 
ABS(X) 
·µ»ØXµÄ¾ø¶ÔÖµ¡£ 
mysql ......

mysql Êý¾Ý¿âÒýÇæ

Èç¹ûÄãÊǸöÈü³µÊÖ£¬²¢ÇÒ°´Ò»Ï°´Å¥¾ÍÄܹ»Á¢¼´¸ü»»ÒýÇæ¶ø²»ÐèÒª°Ñ³µ¿ªµ½³µ¿âÀïÈ¥»»£¬ÄÇ»áÊÇʲô¸Ð¾õÄØ£¿MySQLÊý¾Ý¿âΪ¿ª·¢ÈËÔ±Ëù×öµÄ¾ÍºÃÏñÊÇ°´°´Å¥»»ÒýÇ棻ËüÈÃÄãÑ¡ÔñÊý¾Ý¿âÒýÇ棬²¢¸øÄãÒ»Ìõ¼òµ¥µÄ;¾¶À´Çл»Ëü¡£ 
MySQLµÄ×Ô´øÒýÇæ¿Ï¶¨Êǹ»ÓÃÁË£¬µ«ÊÇÔÚÓÐЩÇé¿öÏ£¬ÆäËûµÄÒýÇæ¿ÉÄÜÒª±ÈÊÖÍ·ËùÓøüÊʺÏÍê³ÉÈÎÎñ¡£Èç¹ûÔ¸ ......

mysql µ¼Èëµ¼³ö


1.CMDÃüÁîÐÐÏÂÇл»µ½ mysql°²×°Ä¿Â¼ÏµÄbinĿ¼
ÀýÈç:cd D:\program\study\mysql\bin>
2. D:\program\study\mysql\bin> mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > sqlÎļþ´æ·Å·¾¶ºÍÃû³Æ
D:\program\study\mysql\bin>mysqldump -u root -p oa > D:\oa.sql
3.ÊäÈëÃÜÂë
4.ÉÔ΢µÈ´ýƬ¿Ì(Êý¾Ý¿â½Ï´óµÈ´ýʱ¼ä¿ÉÄ ......

MySQLµÄLOCK TABLES/UNLOCK TABLES

LOCK TABLES/UNLOCK TABLES ¾ä·¨
LOCK TABLES tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}
[, tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE} ...]
...
UNLOCK TABLES
LOCK TABLES Ϊµ±Ç°Ïß³ÌËø¶¨±í¡£UNLOCK TABLES Êͷŵ±Ç°Ïß³ÌÓµÓеÄËùÓÐËø¶¨¡£µ±Ï̷߳¢³öÁíÒ»¸ö LOCK TABLES£¬»òµ±Óë·þ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ