[ MYSQL ] 날짜 증가 후 조회 (date_sub('$date', interval '12' month) 12달 (date_sub('$date', interval '1' day) 하루 Today WHERE t_date=CURDATE(); Tomarrow WHERE t_date=CURDATE() + INTERVAL 1 DAY; Yesterday WHERE t_date=CURDATE() - INTERVAL 1 DAY; DB/MYSQL HEON.D 2022.05.27
[ MYSQL ] AutoIncrement 값 초기화 ALTER TABLE NUTRIENT AUTO_INCREMENT = 원하는 숫자; DB/MYSQL HEON.D 2022.01.13
[ MYSQL ] FULLTEXT Search 파라미터 변경 ngram_token = 2 innodb_ft_min_token_size = 2 ft_min_word_len = 2 적용확인 show variables like 'ft_min%'; show variables like 'innodb_ft_min%'; 검색 인덱스 추가 ALTER TABLE MANUAL ADD FULLTEXT(칼럼명); 조회 쿼리 SELECT 칼럼, MATCH (칼럼) AGAINST ('키워드*' IN BOOLEAN MODE) AS score FROM 테이블 ORDER BY score desc; SELECT manual_title, ( ((LENGTH(manual_title) - LENGTH((REPLACE(manual_title, '관리', '')))) / LENGTH('관리.. DB/MYSQL HEON.D 2022.01.12
[ MYSQL ] RDS time_zone 변경 1. 파라미터 그룹 복제 ( 기본 파라미터 그룹은 수정이 불가하다 ) 2. time_zone 파라미터 항목 수정 3. 인스턴스 재부팅 ( 재부팅 전에는 새로운 파라미터 그룹이 적용되지 않는다 ) DB/MYSQL HEON.D 2021.11.19
[ MYSQL ] Timezone 확인 select @@global.time_zone, @@session.time_zone; select NOW(); SHOW GLOBAL VARIABLES LIKE '%zone%'; DB/MYSQL HEON.D 2021.11.19
[ MYSQL ] 컬럼 구조 확인 SELECT TABLE_NAME AS 'table_name', ORDINAL_POSITION AS 'no', COLUMN_NAME AS 'field_name', COLUMN_COMMENT AS 'comment', COLUMN_TYPE AS 'type', COLUMN_KEY AS 'KEY', IS_NULLABLE AS 'NULL', EXTRA AS 'auto', COLUMN_DEFAULT 'default' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '데이터베이스명' ORDER BY TABLE_NAME, ORDINAL_POSITION; SELECT t1.table_name, t1.table_comment, column_name, data_type, colu.. DB/MYSQL HEON.D 2021.11.17
[ MYSQL ] DATETIME Null값 체크 증상 DATETIME 수정이 일어난 경우 0000-00-00 이 기본 값으로 입력됨 해결 UNIXTIME 기준으로 검증한다 IF(UNIX_TIMESTAMP(O.delivery_complete_time) = 0,'미입력', O.delivery_complete_time) AS delivery_complete_time 관련링크 https://stackoverflow.com/questions/559590/selecting-empty-mysql-datetime-fields Selecting empty mysql datetime fields Is there a better way to select empty datetime fields than this? SELECT * FROM `table` WHERE `date.. DB/MYSQL 라넌.B 2021.10.21
[ MYSQL ] WHERE 를 통한 DELETE 안될때 에러메세지 Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 해결방법 Safe 모드 비활성화 set sql_safe_updates=0; 작업후 다시 Safe 모드를 활성화 시켜놓을 것 set sql_safe_updates=1; DB/MYSQL HEON.D 2021.09.25
[ MYSQL ] Column Flag PK - Primary Key NN - Not Null BIN - Binary (stores data as binary strings. There is no character set so sorting and comparison is based on the numeric values of the bytes in the values.) UN - Unsigned (non-negative numbers only. so if the range is -500 to 500, instead its 0 - 1000, the range is the same but it starts at 0) UQ - Create/remove Unique Key ZF - Zero-Filled (if the length is 5 like .. DB/MYSQL HEON.D 2021.02.05