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

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


Ïà¹ØÎĵµ£º

java µ÷ÓÃÃüÁî ±¸·ÝmysqlÊý¾Ý¿â

 ´úÂëÈçÏ£º
  1  String command  =   " cmd /c C:/Program Files/MySQL/MySQL Server 5.0/bin>mysqldump -h localhost -u root -p aijia > E:/aijia.dmp " ;
  2      try    {
  3     Process process& ......

java µ÷ÓÃmysql¿Í»§¶Ëµ¼È룬µ¼³öÊý¾Ý

 ×î½üÓöµ½Ò»¸öÐèÇóÒªÔÚlinuxÏÂÓÃjava µ÷ÓÃmysql¿Í»§¶ËÔ¶³ÌµÇ½mysql·þÎñÆ÷£¬´Ó¿Í»§¶Ë»úÆ÷µ¼Èëmysql½Å±¾£¬´Ómysql·þÎñÆ÷¶Ëµ¼³ö±íÖеÄÊý¾Ý¡£ÒÔÏÂÊÇÓõ½µÄÖ÷Òª·½·¨£º
Java ´úÂë 
/**  
 * µ¼ÈëÊý¾Ý  
  * @param  ½Å±¾µÄµØÖ·ºÍÃû³Æ  
 * @return ÊÇ·ñ³ ......

MySql ×Ö·û´®º¯Êý


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 Íâ¼ü¶¨Òå




½¨Á¢Íâ¼üµÄÇ°Ì᣺ ±¾±íµÄÁбØÐëÓëÍâ¼üÀàÐÍÏàͬ(Íâ¼ü±ØÐëÊÇÍâ±íÖ÷¼ü)¡£
Íâ¼ü×÷Ó㺠ʹÁ½ÕűíÐγɹØÁª£¬Íâ¼üÖ»ÄÜÒýÓÃÍâ±íÖеÄÁеÄÖµ£¡
Ö¸¶¨Ö÷¼ü¹Ø¼ü×Ö£º foreign key(ÁÐÃû)
ÒýÓÃÍâ¼ü¹Ø¼ü×Ö£º references <Íâ¼ü±íÃû>(Íâ¼üÁÐÃû)
ʼþ´¥·¢ÏÞÖÆ: on deleteºÍon update , ¿ÉÉè²ÎÊýcascade(¸úËæÍâ¼ü¸Ä¶¯ ......

MYSQL£ºCannot convert value '0000

½ñÌì´ÓMYSQLÊý¾Ý¿âץȡʱ£¬·¢ÉúÁËCannot convert value '0000-00-00 00:00:00' from column 10 to TIMESTAMPÒì³£
googleÁËһϣ¬´ó¸ÅÒâ˼ÊÇMySQLÖеÄDatetimeÖµÎÞ·¨ÔÙJAVAÖпɿ¿µÄ±»±íʾ£¬°´ÕÕJDBCºÍSQLµÄ±ê׼ĬÈÏÇé¿öϲúÉúÒì³£¡£
JDBCÔÊÐíÓÃÏÂÁеÄÖµ¶ÔzeroDateTimeBehavior ÊôÐÔÀ´ÉèÖÃÕâЩ´¦Àí·½Ê½£¬
exception (the d ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ