출처: https://hjjungdev.tistory.com/153 Mysql (Maria) Db 테이블락 확인하고 강제중지 방법. 테이블락은 어떻게 걸리는가? 보통 기본설정의 Rdbms는 Select문을 제외하고 Delete/Update/Insert문에 대해서 테이블 락을 걸게됩니다. 가령 A라는 사람이 Delete Table;의 명령문을 실행한 상태에서 커밋을 hjjungdev.tistory.com -- 락테이블 조회 select * from information_schema.innodb_locks; -- 대기중인 락 조회 select * from information_schema.innodb_lock_waits; MariaDB [mysql]> select * from information_schem..
참조: https://solbel.tistory.com/1934 [sql/mysql] mysql nullif example / mysql 공백과 null 체크 방법 [sql/mysql] mysql nullif example / mysql 공백과 null 체크 방법 mysql 에서 컬럼이 빈값인 경우만 조회를 하려면 is null 이라는 것을 사용합니다. 예를들어, member 라는 테이블에서 name 라는 컬럼.. solbel.tistory.com select test1 from test where test1 IS NULL 위 쿼리 실행 시 test1 컬럼이 NULL인 데이터만 조회됨 select test1 from test where NULLIF(test1, '') IS NULL NULLIF 사용 시 ..
(select `order` from test1) UNION ALL (select '11' as order) order by order 위와 같은 쿼리에서 두번째 쿼리에 order 값이 '11' 문자열로 되어 있어 order 순이 1, 10, 100 순으로 정렬이 됨 (select `order` from test1) UNION ALL (select 11 as order) order by order 정상적인 order순이 되려면 숫자로 해야함 (select `order` from test1 order by `order`) UNION ALL (select '11' as order) 위와 같이 order by를 특정 쿼리에만 적용 시 정상적으로 order by 되지않음 통합쿼리에 order by 처리 필요
참조: https://prinha.tistory.com/entry/MySQL-Error-1068-Multiple-primary-key-defined [MySQL Error] 1068. Multiple primary key defined 테이블에 PRIMARY KEY 컬럼을 추가할 때, 기존 PRIMARY KEY들이 잡혀있기 때문에 멀티플 오류가 났다. 해결방법은 ! 1) 추가할 컬럼을 추가하기 ALTER TABLE 테이블명 ADD 컬럼명 varchar(20) not null default '.. prinha.tistory.com https://karzin.tistory.com/232 [MariaDB, MySQL] 에러해결 : Multiple primary key defined [MariaDB, MySQL..
참조 : https://seongtak-yoon.tistory.com/52 [MySQL] 두개의 컬럼을 IN 절로 비교하기 쿼리 조건을 구성하다보면 멀티키와 같은 컬럼 중 일부를 제외하고 싶을 때가 있습니다. 1건이 아니라 여러건을 조회할 때 기대치 : 1-a, 2-b, 3-c만 원할 때 SELECT * FROM foo WHERE id IN (1, 2, 3) AND bar IN.. seongtak-yoon.tistory.com SELECT * FROM foo WHERE (id, bar) IN ((1, 'a'), (2, 'b'), (3, 'c'))