본문 바로가기

반응형

DB(SQL)/mysql|maria

(45)
[MYSQL] 유용한 명령어 GROUP_CONCAT https://fruitdev.tistory.com/16 [MySQL] GROUP_CONCAT 사용하기 필요에 의해 서로 다른 결과를 한줄로 합쳐서 보여줘야 할 경우가 있다. 전체 결과값을 가져와서 java 와 같은 프로그램 언어에서 for 문을 돌며 문자열을 붙여도 되긴 하지만 Select 쿼리를 던질때 fruitdev.tistory.com
[MYSQL] USER 테이블의 모든 계정의 권한을 다 N으로 변경 하였을 겨우
[mysql/maria] upsert (insert /update) upsert 라는 기능이 있습니다. (있으면 update 없으면 insert) 버전에 따라서 지원을 안할 경우 트리거를 이용하여 할수도 있으나 버전이 된다면 아래와 같은 명령어로 사용할 수 있습니다. (test해보지 않아 문법이 틀릴 수 있습니다. 자세한 사항은 Docs를 참조해주세요.) (버전에 따라 명령어가 실행되지 않을 수 있습니다. 적용되는 버전은 Docs를 참조해주세요.) t1 ---------------- a | b | c | ---------------- 1 | 2 | 3 | a unique key insert / update INSERT INTO t1 (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE c=c+1; or UPDATE t1 SET c=c+1 W..
[MariaDB ] Real MariaDB 인덱스 머지 http://www.gurubee.net/lecture/4197 인덱스 머지(INDEX MERGE) 5.8 인덱스 머지(index_merge) (MariaDB)(MySQL)인덱스를 이용하여 테이블을 읽는 경우 대부분은 하나의 인덱스만 활용할 수 있다.인덱스 머지 실행계.. www.gurubee.net
[MYSQL/MARIA] 복합 UNIQUE KEY와 NULLABLE Composite Unique key constraint with multiple null value in one of the column 예를들어 room_id와 camera_number를 복합 unique key로 설정하였다. 그리고 room_id는 nullable 하다. 그럴 경우 아래와 같이 했을 때 error가 날까? 결론 아니다. 왜? null 은 값이 아니라 비교가 불가능 하기 때문. 테이블 구성할때 이부분을 조심해야할것 같다. https://stackoverflow.com/questions/54287281/composite-unique-key-constraint-with-multiple-null-value-in-one-of-the-column Composite Unique key const..
[Mysql] ONLY_FULL_GROUP_BY (Maria DB) 본인 테스트 VERSION : 10.1.47-MariaDB-0ubuntu0.18.04.1 mysql 5.7 version 부터 sql_mode 추가된것에 대한 피드백이다. SQL-92 and earlier does not permit queries for which the select list, HAVING condition, or ORDER BY list refer to nonaggregated columns that are not named in the GROUP BY clause. For example, this query is illegal in standard SQL-92 because the nonaggregated name column in the select list does not app..
[Maria db] 데이터베이스 이력 쌓기 (query log) https://mariadb.com/kb/en/server-monitoring-logs/ Server Monitoring & Logs mariadb.com 1-1. DB 셋팅 확인 file # mysql cat /etc/my.cnf # mariadb # mariadb 는 /etc/mysql/mysql.cnf 도 같이 봐야한다. cat /etc/mysql/mariadb.conf.d/50-server.cnf 1-2. 셋팅 확인 (sql) -- mysql 접속 SHOW VARIABLES LIKE 'general_log'; # 기본 로그 저장 유무 SHOW VARIABLES LIKE 'general_log_file'; # 기본 로그 file 저장 경로 SHOW VARIABLES LIKE 'slow_query_l..
[MYSQL] performance-schema-statement-tables dev.mysql.com/doc/refman/5.6/en/performance-schema-statement-tables.html MySQL :: MySQL 5.6 Reference Manual :: 22.12.6 Performance Schema Statement Event Tables 22.12.6 Performance Schema Statement Event Tables The Performance Schema instruments statement execution. Statement events occur at a high level of the event hierarchy: Wait events nest within stage events, which nest within statement e..

반응형