Tree구조를 가지는 데이타를 하나의 쿼리로 조회하고 싶은 경우가 있다.

Oracle에서는 connect by를 이용하면 간단히 구현되지만 MySQL에서는 조금 까다로운 것이 사실이다. 솔루션이 아래 URL에 잘 설명되어있다.

http://explainextended.com/2009/07/20/hierarchical-data-in-mysql-parents-and-children-in-one-query/
Creative Commons License
Creative Commons License
Posted by 지오아빠^^


SELECT LENGTH(str) - INSTR(REVERSE(str), char) + 1
SELECT LENGTH("abc123abc") - INSTR(REVERSE("abc123abc"), "a") + 1

요따구로 만들고 포스팅하는 것좀봐 ㅜㅡ....
Creative Commons License
Creative Commons License
Posted by 지오아빠^^


많은 솔루션이 있겠지만, sql 파일 제일 처음에 set names euckr; 를 입력해 주는게 제일 쉬울듯!
Creative Commons License
Creative Commons License
Posted by 지오아빠^^
TAG MySQL, 한글
MySQL에서 테이블 생성시 ENGINE 값에 테이블 형식을 지정할 수 있다.
그중에 MyISAM은 MySQL의 기존 테이블 형식이다.
기본이니 만큼 알고 사용할 필요가 있을 것 같다.

http://radiocom.kunsan.ac.kr/lecture/mysql/table_myisam.html
Creative Commons License
Creative Commons License
Posted by 지오아빠^^
TAG db, MyISAM, MySQL


To increase the maximum connections that mysql allows, you must edit the file /etc/my.cnf. Log into the server as root, and type this:


vi /etc/my.cnf


There will be a section that looks like this: (may be slightly different)


[mysqld] safe-show-database innodb_data_file_path=ibdata1:10M:autoextend datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock


Add the following line under [mysqld]


max_connections=250

The resulting config file should resemble this:

[mysqld] safe-show-database innodb_data_file_path=ibdata1:10M:autoextend datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock max_connections=250


You then save the changes, and type the following to restart mysqld:


/etc/init.d/mysqld restart


You will see:


Stopping mysql: [ OK ]
Starting mysql: [ OK ]


If Stopping FAILS, then you did something wrong. Try to backtrack and make sure you entered the new setting correctly.

Creative Commons License
Creative Commons License
Posted by 지오아빠^^