= |
= !! php |
= * __mysql_num_rows()__ = Äõ¸®ÀÇ °¹¼ö |
= * __mysql_insert_id()__ = Äõ¸®ÀÇ ¾ÆÀ̵ð |
= |
= !! varcharÇü ¼ýÀÚ Á¤·Ä |
= * order by CAST(Çʵå¸í AS UNSIGNED) varchar ¼ýÀÚ Á¤·Ä½Ã |
= |
= !! mysql |
= * __set names euckr__ = mysql Äɸ¯ÅͼÂÀ» Çѱ۷Π|
= * __truncate__ table = Å׺ñºí ÃʱâÈ |
= |
= !! Å×ÀÌºí º¹»ç |
= * insert into ab2 select * from ab |
= * select * into ab2 from ab |
= |
= !! mysql ¿ÜºÎ Á¢¼Ó½Ã ÁÖ¼®Ã³¸® |
= {{{ |
= #bind-address=127.0.0.1 |
= }}} |
= |
- !!! mysql ¿ÜºÎ Á¢¼Ó½Ã ÁÖ¼®Ã³¸® |
- #bind-address=127.0.0.1 |
- |
- |
- |
= !! mysql replace ¿¹Á¦ |
= {{{ |
= update <table> set content=replace(content,"<br />", ""); |
= }}} |
= |
= !! mysql primary key »èÁ¦½Ã |
= {{{ |
= alter table Å×À̺í¸í drop primary key |
= }}} |
= |
= !! Äɸ¯ÅÍ ¼Â º¯°æ½Ã |
= {{{ |
= alter table [Å×À̺í¸í] convert to character set [Äɸ¯ÅͼÂ] collate [ÄÝ·º¼ÇÀ̸§]; |
= convert to character set utf8 collate utf8_general_ci; |
= |
= ALTER DATABASE db_name DEFAULT CHARACTER SET charset; |
= ALTER TABLE table_name DEFAULT CHARACTER SET charset |
= |
= }}} |
= |
= !! Å×ÀÌºí ¸¸µé¶§. |
= {{{ |
= 5.0 ÀÌ»óÀÏ ¶§.. µ¥ÀÌŸ º£À̽º |
= |
= CREATE DATABASE DB¸í DEFAULT CHARACTER SET euckr COLLATE euckr_korean_ci; |
= CREATE DATABASE DB¸í DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; |
= }}} |
= |
= !! MySQL5.x ¿¡¼ MySQL4.x ¿¡ Áý¾î ³ÖÀ» ´ýÇÁ¸¦ ¹ÞÀ»½Ã |
= {{{ |
= mysqldump -u »ç¿ëÀÚ -p --default--character-set=euckr --compatible=mysql40 µðºñ¸í > ÆÄÀϸí.sql |
= }}} |
= |
= |
= |
= !! Å×ÀÌºí º¹±¸ |
= {{{ |
= mysql> analyze table table_name; |
= +--------------------------+---------+----------+-----------------------------+ |
= | Table | Op | Msg_type | Msg_text | |
= +--------------------------+---------+----------+-----------------------------+ |
= | xxxxxxxxxx_db.table_name | analyze | status | Table is already up to date | |
= +--------------------------+---------+----------+-----------------------------+ |
= |
= mysql> repair table table_name; |
= +--------------------------+--------+----------+-----------------------------+ |
= | Table | Op | Msg_type | Msg_text | |
= +--------------------------+--------+----------+-----------------------------+ |
= | xxxxxxxxxx_db.table_name | repair | status | Table is already up to date | |
= +--------------------------+--------+----------+-----------------------------+ |
= |
= Å×ÀÌºí¿¡ ´ëÇÑ º¸°í¼¿Í º¹±¸¸¦ ½ÃµµÇصµ ¾ÈµÉ°æ¿ì... |
= |
= # myisamchk -r table_name |
= - recovering (with sort) MyISAM-table '/home/mysql/xxxxxxxxxx/table_name' |
= Data records: 1650 |
= - Fixing index 1 |
= Key 1 - Found wrong stored record at 822660 |
= - Fixing index 2 |
= - Fixing index 3 |
= - Fixing index 4 |
= Data records: 1637 |
= |
= ¸í·É¾î¸¦ ÅëÇؼ ¼öÁ¤ÇÒ ¼ö ÀÖÀ½.. %%% |
= ^^ ¬ž¿À~ |
= |
= }}} |
= |
= !! ³¯ÀÚÇÔ¼ö |
= {{{ |
= mysql> SELECT DATE_ADD('1998-01-02', INTERVAL 31 DAY); |
= -> '1998-02-02' |
= mysql> SELECT ADDDATE('1998-01-02', INTERVAL 31 DAY); |
= -> '1998-02-02' |
= |
= mysql> SELECT ADDDATE('1998-01-02', 31); |
= -> '1998-02-02' |
= |
= ADDTIME(expr1,expr2) |
= ADDTIME() adds expr2 to expr1 and returns the result. expr1 is a time or datetime expression, and expr2 is a time expression. |
= |
= mysql> SELECT ADDTIME('1997-12-31 23:59:59.999999', |
= -> '1 1:1:1.000002'); |
= -> '1998-01-02 01:01:01.000001' |
= mysql> SELECT ADDTIME('01:00:00.999999', '02:00:00.999998'); |
= -> '03:00:01.999997' |
= |
= }}} |
= |
= !! µðºñ Àüü ¹é¾÷ |
= {{{ |
= mysqldump --all-databases > sample.sql |
= }}} |
= |
= |
= !! ·£´ýÇÏ°Ô »Ì´Â Äõ¸® |
= {{{ |
= |
= ÀÏ´Ü ±×³É »óÀ§ 5°³¸¸ »Ì´Â °Í |
= |
= MS-SQL¿¡¼´Â |
= SELECT TOP 5 * FROM tTag |
= |
= mysql¿¡¼´Â |
= SELECT * FROM tTag Limit 5 |
= |
= ------------------------------------------- |
= |
= RandomÇÏ°Ô »óÀ§ 5°³¸¦ »Ì´Â °Í |
= |
= MS-SQL¿¡¼´Â |
= SELECT TOP 5 * FROM tTag ORDER BY NEWID() |
= |
= mysql¿¡¼´Â |
= SELECT * FROM tTag ORDER BY RAND() Limit 5 |
= |
= }}} |
= |
= latin1 -> euckr |
= {{{ |
= 1. ¹é¾÷Çϱâ |
= mysqldump -u{username} -p{password} {dbname} --default-character-set latin1 > {dump}.sql |
= ¿©±â¼ Á¦ÀÏ Áß¿äÇÑ °ÍÀÌ --default-character-set latin1 ÀÔ´Ï´Ù. |
= ÀÌ°ÍÀÌ ¾øÀ¸¸é ¿ÂÀüÇÏ°Ô ¹é¾÷ÀÌ µÇÁö ¾ÊÀ¸´Ï ¿©·¯°¡Áö·Î ¾î·Æ½À´Ï´Ù. |
= |
= 2. ¹®Àڼ º¯È¯Çϱâ |
= (¹®Á¦°¡ µÇ´Â °ÍÀÌ º¸Åë ÀÌ °úÁ¤¿¡¼ ¸Þ¸ðÀåÀ̳ª ¿¡µñÅ͸¦ ÀÌ¿ëÇÏ°Ô µÇ¸é ±úÁ®¼ º¹¿øÀ» ÇÒ¶§ ¿¡·¯°¡ ¹ß»ýÇÕ´Ï´Ù.) |
= utf8·Î º¯È¯ ÇÒ¶§ |
= iconv -c -f cp949 -t utf-8 ¿øº»ÆÄÀϸí > º¯È¯µÉ ÆÄÀϸí.sql |
= euckr À̶ó¸é º¯È¯ ÇÒ¶§ |
= iconv -c -f cp949 -t euckr ¿øº»ÆÄÀϸí > º¯È¯µÉ ÆÄÀϸí.sql |
= }}} |
= |
= * http://blog.naver.com/seuis398?Redirect=Log&logNo=70066657549 |
= |
= !! Á¶°Ç½ÄÀ» ÁÖ¾î¼ sum °ªÀ» °¡Á®¿À´Â ¹æ½Ä |
= {{{ |
= SUM(B.CLASS_PAY) AS CLASS_PAY, |
= |
= |
= SUM( |
= CASE B.GRADE |
= WHEN '11' THEN B.CLASS_PAY |
= END |
= )AS CLASS_PAY2, |
= }}} |
= |