mysql ʱ¼ä¶Î²éѯ
24СʱÄڼǼ£¨¼´86400Ã룩
$sql="SELECT video_id,count(id)as n from `rec_down` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(add_time)<=86400 group by video_id order by n desc ";
$sql="select a.id,a.title,b.n from video_info a,(".$sql.")b where a.id=b.video_id order by n desc limit 20";
NÌìÄڼǼ
WHERE TO_DAYS(NOW()) - TO_DAYS(ʱ¼ä×Ö¶Î) <= N
½ñÌìµÄ¼Ç¼
where date(ʱ¼ä×Ö¶Î)=date(now())
»ò
where to_days(ʱ¼ä×Ö¶Î) = to_days(now());
²éѯһÖÜ£º
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);
²éѯѡÔñËùÓÐ 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 ÖеÄÔÂ
Ïà¹ØÎĵµ£º
ÍøÕ¾µÄÊý¾Ý¿âÊǵ÷ÓÃÔ¶³Ì·þÎñÆ÷ÉϵÄ,²»ÊDZ¾»úµÄ.ÍøÕ¾´ò¿ª±È½ÏÂý.ÔÚÍøÉÏËÑË÷ÁË·½·¨,Õâ¸ö·½·¨¿ÉÒÔ½â¾ö,µ«ÊÇÓÐÁíÍâµÄÎÊÌâ³öÏÖ:
-----------------------------------------------------------------------
ÔÚ¾ÖÓòÍøÄÚÁ¬½ÓÆäËû»úÆ÷µÄMYSQL,·¢ÏÖËÙ¶ÈÂýµÄºÜ,²»ÖªµÀʲôÔÒò,×ÜÓм¸ÃëµÄÑÓ³Ù.
ºóÀ´ÔÚÍøÉÏ·¢ÏÖ½â¾ö·½·¨,my.iniÀïÃæÌ ......
°²×°JDBCÇý¶¯£º
½âѹËõmysql-connector-java-3.1.10.zip
½«ÒªÊ¹ÓõÄÊÇmysql-connector-java-3.1.10-bin-g.jarºÍmysql-connector-java-3.1.10-bin.jar
ÅäÖÃ
ÔÚC:\Program Files\JavaĿ¼Ï½¨Á¢mysqlforjdbc×ÓĿ¼£¬½øÈë¸ÃĿ¼½«mysql-connector-java-3.1.10-bin.jarµ½¸ÃĿ¼ÏÂ
½øÈëC:\Program Files\Java\jdk1.5.0_04\l ......
Éý¼¶mysqlÊý¾Ý¿âµÄ·½·¨£º
1. ÏÂÔØ°²×°½éÖÊmysql-essential-5.1.46-win32.msi
¿ÉÒÔµ½¹ÙÍøhttp://www.mysql.com/click.php?e=35166»òÆäËûÍøվȥÏÂÔØ£»
2. ±¸·ÝmysqlµÄÊý¾Ý£»
ÔËÐÐcmd´ò¿ªÃüÁîÌáʾ·û£¬½øÈëµ½mysqlÈí¼þµÄ ......
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö²ÎÊý-h»úÆ÷IP
µ ......
»ùÓÚMySQLºÍInfobrightµÄÊý¾Ý²Ö¿â¼¼Êõ
Êý¾Ý²Ö¿â/·ÖÎö/ÉÌÎñÖÇÄÜ( BI )ÁìÓòÕýÔÚ·ÉËÙ·¢Õ¹¡£ÔÚ¼¤Áҵľ¼Ã¾ºÕùÖÐËùÓÐÐÐÒµºÍÖÇÄÜÆóÒµÐèÒªÀûÓÃÆäÄÚ²¿µÄÊý¾ÝÀ´×ö³öÖØÒªµÄÉÌÒµ¾ö²ß£¬°üÀ¨Õ½ÊõºÍÕ½ÂÔÁ½·½Ã棬ÒÔ±£³ÖÐÐÒµµÄÁìÏȵØλ¡£
Êý¾Ý²Ö¿â(Èç¶ÔMySQLµÄÒ»´ÎÖØ´óÉç»áºÍ¿Í»§µ÷²é)Ä¿Ç°ÊÇMySQLµÄµÚÎåÖÖ×î³£¼ûµÄÓ¦Óá£ÏÖÔÚÓÃÓÚMySQLÊý¾Ý ......