mysql²éѯһÌ죬²éѯһÖÜ£¬²éѯһ¸öÔµÄÊý¾Ý
²éѯһÌ죺
select * from table where to_days(column_time) = to_days(now());
select * from table where date(column_time) = curdate();
²éѯһÖÜ£º
select * from table where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(column_time);
²éѯһ¸öÔ£º
select * from table where DATE_SUB(CURDATE(), INTERVAL INTERVAL 1 MONTH) <= date(column_time);
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");
&nbs
Ïà¹ØÎĵµ£º
my.iniÎļþÅäÖ㺠[mysql] default-character-set=GBK #´Ë´¦µÄ±àÂëÊÇMySQL¿ØÖÆ̨ÏÔʾµÄ±àÂ뷽ʽ£¬Ó¦¸ÃÉèÖÃΪGBK [mysqld] default-character-set=utf8 #´Ë´¦µÄ±àÂëÊÇMySQLÊý¾Ý´æ´¢µÄ¸ñʽ£¬Ó¦¸ÃÉèÖÃΪutf8£¬¿ÉÒÔ´æ´¢ÊÀ½çÉϾø´ó¶àÊý×Ö·û ......
Ò»¡¢ÎÊÌâµÄÌá³ö
¡¡¡¡ÔÚÓ¦ÓÃϵͳ¿ª·¢³õÆÚ£¬ÓÉÓÚ¿ª·¢Êý¾Ý¿âÊý¾Ý±È½ÏÉÙ£¬¶ÔÓÚ²éѯSQLÓï¾ä£¬¸´ÔÓÊÓͼµÄµÄ±àдµÈÌå»á²»³öSQLÓï¾ä¸÷ÖÖд·¨µÄÐÔÄÜ¡£ÓÅÁÓ£¬µ«ÊÇÈç¹û½«Ó¦ÓÃϵͳÌύʵ¼ÊÓ¦Óúó£¬Ëæ×ÅÊý¾Ý¿âÖÐÊý¾ÝµÄÔö¼Ó£¬ÏµÍ³µÄÏìÓ¦ËٶȾͳÉΪĿǰϵͳÐèÒª½â¾öµÄ×îÖ÷ÒªµÄÎÊÌâÖ®Ò»¡£ÏµÍ³ÓÅ»¯ÖÐÒ»¸öºÜÖØÒªµÄ·½Ãæ¾ÍÊÇSQLÓï¾äµÄÓÅ»¯¡£¶ÔÓ ......
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 ......
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¹«Ë¾ÒÔ´æ´¢ÒýÇ淽ʽÌṩµÄ¸ß¿É¿¿ÐÔ·½°¸£¬ÊÇÊÂÎñ°²È«µÄ£¬ÊµÊ±¸´ÖÆÊý¾Ý
£¬¿ÉÓ ......