short는 MySQL의 small int와 동일합니다. Java short는 -32768 ~ 32767 범위의 2바이트를 사용하는 반면 MySQL smallint도 동일한 범위의 2바이트를 사용합니다.
다음은 Java로 된 short의 데모 코드입니다 -
public class SmallIntAsShortDemo {
public static void main(String[] args) {
short value = 32767;
System.out.println(value);
value = -32768;
System.out.println(value);
// value = 32768;
// System.out.println(value);
}
} 스냅샷은 다음과 같습니다 -

이것은 다음과 같은 출력을 생성합니다 -
32767 -32768
다음은 EclipseIDE에서 실행한 출력의 스냅샷입니다.

MySQL smallint는 동일한 범위에서 2바이트를 사용합니다.