[SQL] varchar(50)은 몇 글자를 저장할 수 있을까?

2022. 11. 8. 15:12·📂 Infra & System
728x90
반응형

varchar(50)에 몇 글자가 저장될까?

한글은 3바이트라서 50 % 3 즉 16글자 정도 저장이 될 줄 알았다.

하지만 프런트 단에서 확인 결과 16글자 이상 저장이 되어 확인해 보았다.

 

1. mysql에서의 글자수 저장


mysql4.0 버전까지 varchar(50)은 바이트를 의미하고 

mysql5.0 버전까지 varchar(50)은 charaters를 의미한다

 

즉 mysql4.0버전 이상이면 varchar(50)은 50글자가 저장된다.


https://dev.mysql.com/doc/refman/8.0/en/char.html

링크를 확인해보면

`The CHAR and VARCHAR types are declared with a length that indicates the maximum number of characters you want to store. For example, CHAR(30) can hold up to 30 characters.` 이라고 나와있다.

728x90

 

728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'📂 Infra & System' 카테고리의 다른 글

👋 클라우드 모니터링 서비스 비교하기(데이터독 vs 뉴렐릭 ) | 뉴렐릭 세미나를 다녀오고,  (2) 2024.03.19
[서버] 누구나 Vultr 이용해서 백엔드 서버 구축하기  (0) 2023.06.11
[AWS] Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly. 오류 해결하기  (0) 2022.12.24
[Firebase] firebase.json이란?  (0) 2021.04.23
[Firebase] Firebase시작하기, 초기설정, firebase init 분석  (2) 2021.04.23
'📂 Infra & System' 카테고리의 다른 글
  • [서버] 누구나 Vultr 이용해서 백엔드 서버 구축하기
  • [AWS] Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly. 오류 해결하기
  • [Firebase] firebase.json이란?
  • [Firebase] Firebase시작하기, 초기설정, firebase init 분석
foodev
foodev
이것저것 개발과 이것저것 리뷰 합니다.
    반응형
    250x250
  • foodev
    개발 개맛집
    foodev
  • 전체
    오늘
    어제
    • 분류 전체보기 (103)
      • ⭐ Featured (4)
      • 📂 Backend Engineering (36)
      • 📂 Troubleshooting & Ops (10)
      • 📂 Infra & System (7)
      • 📂 Reflections (20)
        • Year-in-Review (4)
        • Work & Career (10)
        • Lessons Learned (6)
      • 📂 Team Journal (10)
      • 📂 Archive (16)
  • 블로그 메뉴

    • 홈
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    typedi 동작원리
    di의존성
    해피해킹 꿀팁
    해피해킹 방향키
    validation failed (numeric string is expected)
    인프라 로그 저장 비용 감소하는 방법
    db 날린 썰
    di동작원리
    해피해킹 카라비너
    개발썰
    스냅샷과히스토리성 차이
    githubaction 라벨 배포
    토이프로젝트개발일지
    typedi란
    Azure log 비용 줄이기
    db 날림
    githubaction 라벨 ci/cd
    db 초기화
    QueryDSL
    azure ci/cd
    창업패키지후기
    JPA
    서이추
    Azure 로그 최소 저장 30일
    nestjs pipe body
    해피해킹 커스텀
    스냅샷과 히스토리
    di란
    nestjs pipe
    해피해킹 키매핑
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
foodev
[SQL] varchar(50)은 몇 글자를 저장할 수 있을까?
상단으로

티스토리툴바