mysql ÓÃͬһ±íÖеÄÁíÒ»ÐмǼµÄ×ֶθ³Öµ
CREATE TABLE `user` (
`db_id` varchar(255) NOT NULL,
`name` varchar(45) default NULL,
`age` int(10) unsigned NOT NULL,
`address` varchar(45) default NULL,
PRIMARY KEY (`db_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
// ÉèÖÃname='888'µÄageµÈÓÚname='111' +10
update users u,(SELECT age from users where name="111") as t
set u.age = t.age+10
where name="888";
Ïà¹ØÎĵµ£º
×÷ÕߣºÀÏÍõ Èý¹úÑÝÒ忪ƪһÓïµÀÆÆ£ººÏ¾Ã±Ø·Ö£¡MySQLµÄʹÓÃÒàÊÇÈç´Ë£¬Ãæ¶ÔÓ¦ÓÃÖÐÔ½À´Ô½ÅÓ´óµÄÊý¾ÝÁ¿£¬×îʱ÷ֵĽâ¾ö·½°¸ÊÇShard£¬²»¹ýËüµÄ¸´ÔÓÐÔ²¢²»ÊÇÿ¸ö³ÌÐòÔ±¶¼ÄܼÝÔ¦µÄ£¬Èç¹û°Ñ¼Ü¹¹µÄÑݱä±È×÷ÉúÃüµÄ½ø»¯£¬ÄÇôShard¿ÉÒÔ¿´×öÊDz¸È鶯ÎºÜ¶à¼Ü¹¹×îºóÖ®ËùÒÔʧ°Ü£¬¾ÍÊÇÒòΪËüÃDz½×ÓÂõµÃÌ«´ó£¬Ïë´ÓÔʼÉúÃüÖ±½Ó½ø»¯³É²¸Èé¶ ......
from_unixtime()ÊÇMySQLÀïµÄʱ¼äº¯Êý
dateΪÐèÒª´¦ÀíµÄ²ÎÊý(¸Ã²ÎÊýÊÇUnix ʱ¼ä´Á),¿ÉÒÔÊÇ×Ö¶ÎÃû,Ò²¿ÉÒÔÖ±½ÓÊÇUnix ʱ¼ä´Á×Ö·û´®
ºóÃæµÄ '%Y%m%d' Ö÷ÒªÊǽ«·µ»ØÖµ¸ñʽ»¯
ÀýÈç:
mysql>SELECT from_UNIXTIME( 1249488000, '%Y%m%d' )
->20071120
mysql>SELECT from_UNIXTIME( 1249488000, '%YÄê%mÔ ......
Õâ¶Îʱ¼äÔÚ¿´¡¶High Performance MySQL¡·£¬¿´µ½´æ´¢ÒýÇæÕâ¸öµØ·½¸Ðµ½ºÜ¶àϸ½Ú±È½ÏÄ°Éú£¬ËùÒÔ×ܽáС¼ÇһЩ
ΪÁËÊÊÓ¦¸÷ÖÖ²»Í¬µÄÔËÐл·¾³£¬MYSQLÌṩÁ˶àÖÖ²»Í¬µÄ´æ´¢ÒýÇ棨Storage Engine
£©,ÔÚÓ¦ÓóÌÐò¿ª·¢Õâ¸ö²ãÃæÉÏ£¬¿ª·¢Õß¿ÉÒÔ¸ù¾Ý²»Í¬µÄÐèÇóÑ¡ÔñÊʺϵÄStorage Engine
·½°¸£¬¸üΪÁé»îµÄÊÇ£¬Äã¿ÉÒÔ¸ù¾ÝÿÕÅ±í½«Òª´æ´¢Êý ......
£¨1£©ÔÚÉè¼ÆÊý¾Ý¿â×ֶεÄʱºò£¬°ÑÐèÒª»ñÈ¡ÊÖ»úºÅµÄ×Ö¶ÎÉèÖÃΪint(11)£¬ÔÒâÊÇҪȡ11λÊýµÄ£¬½á¹û·¢ÏÖËùÓеÄÊÖ»úºÅÂ룬¶¼±ä³ÉÁË2147483647
£¬¶Ùʱ¾õµÃºÜÆæ¹Ö£¬ÒÔΪÊdzÌÐòÓÐÎÊÌ⣬×îºó·¢¾õÊÇÊý¾Ý¿âÉè¼ÆµÄÎÊÌâ¡£ÒòΪÓзûºÅÕûÊýµÄ×î´óֵΪ
2147483647£¬ËùÒÔ×îºó¾ö¶¨°ÑÊý¾Ý¿âµÄ½á¹¹±ä»¯Ï£¬°Ñint(11)±äΪchar(11)²Å¸ã¶¨¡£
£¨2 ......