-
데이터베이스에 데이터를 넣은 후, 중복된 값이 존재하는지 확인하는 쿼리문이 있다
SELECT * FROM price GROUP BY ID, DATE HAVING COUNT(1) > 1 ORDER BY 1 DESC LIMIT 100;
-> ID를 기준으로 100 번째 까지, id 와 date열을 그룹으로 묶어서 count(1) > 1 즉 하나 이상의 행이 있는 요소들을 select 하는 것이다.
따라서 해당 쿼리문의 결과로 아무런 데이터가 나오지 않는다면, 중복되는 값이 하나도 없다는 뜻이다'Sql' 카테고리의 다른 글
mysql 프로시저 활용하기 (0) 2023.09.07 mySQL 버전에 따른 쿼리문 (0) 2023.06.25 mySQL 다운받기 (0) 2023.05.07 mySql Connections 설정 ( IP 주소 이용 ) (0) 2023.04.17 제약조건 확인, 제약조건 제거 (0) 2023.03.24