mysql£ºÍò¶ñµÄÂÒÂëÖ®whenÓï¾äÖвúÉúµÄÂÒÂë
ʹÓÃmysqlÓÖÓöµ½ÎÊÌâÁË£¬Õâ´ÎÊǹØÓÚÂÒÂëµÄ...
ÆäʵÎÒÒ²±È½ÏÁ˽â±àÂëµÄÎÊÌ⣬Ҳ֪µÀÂÒÂë²úÉúµÄÔÀí£¬¶øÇÒÍøÉ϶ÔmysqlµÄÂÒÂëÎÊÌâÒ²ÓбȽ϶àµÄ½â´ð£¬
µ«ÊǽñÌìÎÒÓöµ½µÄÕâ¸öÂÒÂëÈ´±È½ÏÆæ¹Ö,ÔÚwhenÓï¾äÖвúÉúÁËÆæ¹ÖµÄÂÒÂë¡£
create table my_table(id int, name varchar(50), born DateTime);
insert into my_table values(1, 'ÕÅÈý', 1986-9-9);
insert into my_table values(2, 'ÀîËÄ', 1987-9-10);
insert into my_table values(3, 'ÍõÎå', 1988-9-11);
select case when id like '1' then born when id like '2' then concat(name, born) end from my_table
ÈçÉÏÓï¾äÖ´ÐÐÖ®ºó£¬idΪ2µÄÄÇÐеđÕÅÈý’¾ÍÊÇÂÒÂë¡£¸ÄΪ£º
select case when id like '1' then convert(born, char) when id like '2' then concat(name, born) end from my_table
ÎÊÌâ¼´¿É½â¾ö¡£ÄѵÀwhenÓï¾ä´ÓµÚÒ»¸öÌõ¼þÅж¨Êä³öµÄ±àÂ룿
Ïà¹ØÎĵµ£º
Æô¶¯£ºnet start mySql;
¡¡¡¡½øÈ룺mysql -u root -p/mysql -h localhost -u root -p databaseName;
¡¡¡¡ÁгöÊý¾Ý¿â£ºshow databases;
¡¡¡¡Ñ¡ÔñÊý¾Ý¿â£ºuse databaseName;
¡¡¡¡Áгö±í¸ñ£ºshow tables£»
¡¡¡¡ÏÔʾ±í¸ñÁеÄÊôÐÔ£ºshow columns from tableName£»
¡¡¡¡½¨Á¢Êý¾Ý¿â£ºsource fileName.txt;
¡¡¡¡Æ¥Åä× ......
±¾ÎÄתÔØ×Ô£ºhttp://hi.baidu.com/xiaoxiaolq/blog/item/7984dcbf15dd030018d81f27.html
MyISAMºÍInnoDBÊÇÔÚʹÓÃMySQL×î³£ÓõÄÁ½¸ö±íÀàÐÍ£¬¸÷ÓÐÓÅȱµã£¬ÊÓ¾ßÌåÓ¦Óöø¶¨¡£»ù±¾µÄ²î±ðΪ£ºMyISAMÀàÐͲ»Ö§³ÖÊÂÎñ´¦ÀíµÈ¸ß¼¶´¦Àí£¬¶øInnoDBÀàÐÍÖ§³Ö¡£MyISAMÀàÐ͵ıíÇ¿µ÷µÄÊÇÐÔÄÜ£¬ÆäÖ´ÐÐÊý¶È±ÈInnoDBÀàÐ͸ü¿ì£¬µ«ÊDz»Ìá¹©Ê ......
ÏÂÃæµÄÊÇMySQL°²×°µÄͼ½â:¡¡¡¡
Ë«»÷ÔËÐГsetup.exe”£¬³öÏÖÈçϽçÃ棺
mysql°²×°Ïòµ¼Æô¶¯£¬°´“Next”¼ÌÐø
Ñ¡Ôñ°²×°ÀàÐÍ£¬ÓГTypical£¨Ä¬ÈÏ£©”¡¢“Complete£¨ÍêÈ«£©”¡¢“Custom£¨Óû§×Ô¶¨Ò壩”Èý¸öÑ¡ÏÎÒÃÇÑ¡Ôñ“Custom”£¬Óиü¶àµÄÑ¡ÏҲ· ......
°²×°mysql
sudo apt-get install mysql-server#Ö±½Ó×Ô¶¯»ñµÃ¿ÉÓð汾
Ò²¿ÉÒÔÕâÑùд
sudo apt-geti nstall mysql-server-5.0#°²×°mysql·þÎñÆ÷5.0°æ±¾
°²×°ºó
/etc/init.d/mysqlstart(stop)ΪÆô¶¯ºÍÍ£Ö¹·þÎñÆ÷
/etc/mysql/Ö÷ÒªÅäÖÃÎļþËùÔÚλÖÃmy.cnf
/var/lib/mysql/·ÅÖõÄÊÇÊý¾Ý¿â±íÎļþ¼Ð£¬ÕâÀïµÄmysqlÏ൱ÓÚ ......