인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

briancjkim910559's profile image
briancjkim910559

asked

[A hundred words are not as good as seeing once] Advanced SQL for data analysis

DELETE LeetCode Problem Solving + Section 3 Subquery Preview

id 가 증가하는 숫자가 아니고 uuid나 문자열이라면 어떻게 접근해야되나요

Written on

·

437

0

문제에서는 id가 점차 증가해서 아이디가 작은값 이외를 지웠는데

문자열이라면 크고 작고를 비교할수가없는데 어떻게접근해야되나요?

sql

Answer 1

0

canary4651님의 프로필 이미지
canary4651
Instructor

안녕하세요 lolola님!

문자열끼리 비교를 할 때는 아스키코드(참고: https://ko.wikipedia.org/wiki/ASCII) 순서에 따라서

자리 수에 상관없이 앞자리부터 한 문자씩 비교하여 크기를 결정합니다. 

또 mysql에서는 .strcamp() 함수가 있어서 두 문자열의 크기를 비교할 수도 있습니다. 

아래 문서를 참고하시면 더 자세한 정보를 공부할 수 있습니다.

- https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html#function_strcmp

- https://www.w3schools.com/sql/func_mysql_strcmp.asp

감사합니다 :) 

briancjkim910559's profile image
briancjkim910559

asked

Ask a question