의심스러운 IP 분석 후 삭제

SQL 명령어 모음 작성일: 2025-11-22 수정일: 2025-11-22 08:43
수정
-- 더 간결한 정보로 확인
SELECT 
    ip_address, 
    COUNT(*) as comment_count,
    MIN(created_at) as first_comment,
    MAX(created_at) as last_comment,
    COUNT(DISTINCT short_url) as unique_urls_count
FROM comments 
GROUP BY ip_address 
HAVING comment_count > 5
ORDER BY comment_count DESC
LIMIT 20;

-- 의심스러운 IP의 모든 활동 조회 (IP 주소는 위 결과에서 확인 후 입력)
SELECT id, short_url, LEFT(comment, 100) as comment_preview, created_at
FROM comments 
WHERE ip_address = '208.72.217.90'  -- 확인하고 싶은 IP 입력
ORDER BY created_at DESC
LIMIT 50;


언어: SQL