SQLite VARCHAR 默认大小 [英] SQLite VARCHAR default size

查看:17
本文介绍了SQLite VARCHAR 默认大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 SQLite 中,当我说:

In SQLite, when I say:

CREATE TABLE my_table 
(
    my_column VARCHAR 
);

没有指定VARCHAR的大小,使用的默认大小是多少?

without specifying the size of VARCHAR, what is the default size that is used?

我似乎无法在 sqlite.org 上找到它,也无法从我的数据库文件中找到它.

I can't seem to find it at sqlite.org or figure out from my database file.

我知道 SQLite 在尝试将 varchar(500) 填充到 varchar(30) 时不会强制执行大小,但是在初始大小规范和什么方面是否存在权衡是最佳做法吗?

I know that SQLite doesn't enforce size when trying to stuff varchar(500) into varchar(30), but are there tradeoffs in initial size specification and what are best practices?

推荐答案

没关系.

SQLite 在声明 VARCHAR 类型时不使用大小.事实上,它几乎也不使用该类型.

SQLite does not use sizes when declaring the VARCHAR type. In fact, it almost doesn't use the type either.

您可以将 TEXT 存储在 SQLite 的 INT 列中.SQLite 将从不截断 TEXT 列.

You can store TEXT in an INT column in SQLite. And SQLite will never truncate a TEXT column.

这篇关于SQLite VARCHAR 默认大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆