# unsigned
컴퓨터의 정수표현(unsigned, signed, 보수)
정수 부호의 존재 여부에 따라 표현가능한 범위가 달라진다. 비트 수에 따라 다양한 자료형으로 사용가능하고 표현가능한 수의 범위도 달라진다. 8비트 - char - 2^8개 표현가능 16비트 - short - 2^16개 표현가능 32비트 - int - 2^32개 표현가능 64비트 - long - 2^64개 표현가능 Unsigned (자연수) 음수를 허용하지 않는 자료형 Unsigned char 라고 가정하면 표현 가능 범위는 0 ~ 255 (2^8) Unsigned char 자료형끼리 연산결과를 같은 자료형에 대입하려고하면 11111111 (255) + 00000001(1) => 100000000 9비트가 필요 오버플로발생! 넘친 값은 버리고 실제 이 연산의 결과는 0이 된다. 1(버려짐) // 00000000(실제결과
Mybatis : selectKey사용법
resultType으로 최종반환형은 string keyProperty에 임의로 지정해주는 값은 values에 들어갈 변수명을 지정해주는것 order="BEFORE"는 insert가 되기전 selectKey를 지정해준다는 뜻이다 먼저 SELECT구문을 순서대로 살펴보겠다 cast(detailaccountcd as unsigned) -> 현재 데이터타입이 varchar인 detailaccountcd 칼럼을 부호가 없는 숫자로 캐스팅 한다는것 IFNULL(MAX(cast(detailaccountcd as unsigned)),0) + 1 -> IFNULL은 괄호안의 왼쪽값이 null값일 경우 오른쪽 값으로 바꾼다는것인데 여기서 0으로 지정했으니 null값일 경우 0으로 바꾸는것을 예외처리한것이고 컬럼에 값이 있을경우 MAX를 이용했으니 최대값을 불러오게되고 +1을 주었으니 최대값 +1한 값이 생성된다. 현재 숫자로 캐스팅되었으니 현재 컬럼의 최대값 +
Signed vs Unsigned
Signed number That can be positive or negative Unsigned number The numbers that can only be positive The computer represents all the data using binary. It is impossible for us to identify the data types by looking at the binary code because any given binary code could mean anything. Maybe a number, text, part of the movie etc.. ex) 111 -> 7 If I ask the computer to store 111 inside of the computer, what is the minimum size that you require? The answer is 3 bits. Each bit in my