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

¡¾MySQLÊý¾ÝÀàÐÍ2Ö® ÈÕÆÚʱ¼äÀàÐÍ¡¿


MySQLÈÕÆÚʱ¼äÀàÐÍ´óÖ¿ÉÒÔ·Ö³É(5.0°æ±¾)£º
DATE:4×Ö½Ú 1000-01-01 ----9999-12-31
TIME:3×Ö½Ú -839:59:59 -----839:59:59
YEAR:1×Ö½Ú 1901-----2155
DATETIME:8×Ö½Ú 1000-01-01 00:00:00 -------- 9999-12-31 23:59:59
TIMESTAMP:4×Ö½Ú 19700101080001 -------2038Äêij¸öʱ¿Ì
 
ʹÓÃСÀý£º
 
1.DATE¡¢TIME¡¢DATETIMEµÄ¼òµ¥Ê¹ÓÃ
mysql>create table test(t1 date,t2 time,t3 datetime);
mysql>insert test values(now(),now(),now());
mysql> select * from test;
+------------+----------+---------------------+
| t1         | t2       | t3                  |
+------------+----------+---------------------+
| 2010-05-14 | 15:55:38 | 2010-05-14 15:55:38 |
+------------+----------+---------------------+
 
2.YEARµÄ·¶Î§Ó¦ÓÃ
mysql> create table test2(t year);
mysql> insert test2 values(02),(89);
mysql> select * from test2;
+------+
| t    |
+------+
| 2002 |
| 1989 |
+------+
 
ÔÚ²åÈëÄê·ÝÓöµ½2λÊýµÄʱºò£¬ÒòΪ´æÔÚÄê·ÝÖØµþ£¬ÓÐÈçϹ涨£º00--69 ±íʾ 2000-2069
70-99 ±íʾ 1970-1999
 
 
 
3.TIMESTAMPµÄʹÓÃ
create table test3(value int,t1 timestamp,t2 timestamp);
insert test3 values(1,null,null);
mysql> select * from test3;
+-------+---------------------+---------------------+
| value | t1                  | t2                 &nb


Ïà¹ØÎĵµ£º

MySql±àÂëÎÊÌâ

      ÎÒͬѧ½ÓÁ˸ö˽»î£¬ÏòÎÒÒªÁËmysqlµÄ°²×°Îļþ¡£×òÍíËûÎÊÎÒÓÐûÓöµ½mysqlµÄÂÒÂëÎÊÌ⣬ÎÒ¸øËûµÄ´ð°¸ÊǵÚÒ»´ÎÓõÄʱºòÓöµ½¹ý£¬ÅäºÃÁ˺ó£¬ÏÖÔÚ¶¼Ã»ÓÐÁË¡£Ëû˵ÔÚÍøÉÏÕÒÁ˺ܶàÎÄÕ£¬ÕÕןÄÁËËùÓÐÅäÖÃÎļþ¶¼Ã»½â¾ö¡£
      ÏëÏëÒ²ÊÇ£¬µ±³õµÚÒ»´ÎÓõÄʱºòÒ²ÊÇÒ»Ñù£¬¸ÄÁËËù ......

mysql ½¨Á¢Ë÷Òý

¾ÍÏóÐí¶àµÄPHP¿ª·¢ÕßÒ»Ñù£¬ÔÚ¸Õ¿ªÊ¼½¨Á¢¶¯Ì¬ÍøÕ¾µÄʱºò£¬ÎÒ¶¼ÊÇʹÓÃÏà¶Ô¼òµ¥
µÄÊý¾Ý½á¹¹¡£PHPÔÚÁ¬½ÓÊý¾Ý¿â·½ÃæµÄȷʵÊÇÊ®·Ö·½±ã£¨ÒëÕß×¢£ºÓÐЩÈËÈÏΪPHPÔÚÁ¬½Ó²»Í¬Êý¾Ý¿âʱûÓÐÒ»¸öͳһµÄ½Ó¿Ú£¬²»Ì«·½±ã£¬ÆäʵÕâ¿ÉÒÔͨ¹ýһЩÀ©
Õ¹¿âÀ´×öµ½ÕâÒ»µã£©£¬ÄãÎÞÐè¿´´óÁ¿µÄÉè¼ÆÎĵµ¾Í¿ÉÒÔ½¨Á¢ºÍʹÓÃÊý¾Ý¿â£¬ÕâÒ²ÊÇPHP»ñµÃ³É¹¦µÄÖ÷ ......

mysql×Ö·û¼¯ÉèÖúͲéѯÎÊÌ⣨ת£©

mysql×Ö·û¼¯ÉèÖúͲéѯÎÊÌ⣨ת£©
2010-04-14 11:33
MySQLµÄ×Ö·û¼¯Ö§³Ö(Character Set Support)ÓÐÁ½¸ö·½Ã棺
     ×Ö·û¼¯(Character set)ºÍÅÅÐò·½Ê½(Collation)¡£
¶ÔÓÚ×Ö·û¼¯µÄÖ§³Öϸ»¯µ½Ëĸö²ã´Î:
     ·þÎñÆ÷(server)£¬Êý¾Ý¿â(database)£¬Êý¾Ý±í(table)ºÍÁ¬½Ó(connection) ......

mysqlÎĵµÑ§Ï°3.6

Ô¶³ÌµÇ¼ -h IPµØÖ·
ctrl + d Í˳ö »ò \q »ò quit
select version(); µ±Ç°°æ±¾
current_dateµ±Ç°ÈÕÆÚ »òcurdate() »ò current_date()
SELECT name, birth, curdate(),(year(curdate())-year(birth)) - (right(curdate(),5)<right(birth,5)) as age from ±í ORDER BY name;
year ÌáÈ¡Ä겿·Ö right(curdate(),5)ÌáÈ¡Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ