0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

CHAR型とVARCHAR型の違い

Posted at

CHAR型

・固定長文字列(必ずn文字列分確保される)
・文字数が不足したら、自動的にスペースで埋められる
・文字数が決まっていて、変動がないデータに向いている

例 CHAR(4)に'AB'を入れる
➡'AB'後ろに半角スペースが2つ埋め込まれる。

VARCHAR型

・可変長文字列(入れた文字数だけ保存される)
・余計なスペースは入らない
・長さがバラバラなデータに向いている

例 VARCHAR(4)に'AB'を入れる
➡'AB'

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?