sql - 我可以在 SQLite 中使用负 tinyint 吗?

标签 sql mysql sqlite types

我需要创建一个表(在 SQLite 中),其中有一列包含“-1”或“+1”。为了节省内存,最好不要使用“int”作为列的类型。所以,我想到了“smallint”和“tinyint”。但是 smallint 不是那么小(从 -32,768 到 32,767)并且 tinyint 只能是正值(从 0 到 255)。是否有任何其他选项或我可以在这些 twp 之间进行选择?

提前谢谢你。

最佳答案

SQLite 3 只提供一个 INTEGER 数据类型,它...

[...] is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

来源:http://www.sqlite.org/datatype3.html

关于sql - 我可以在 SQLite 中使用负 tinyint 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1509472/

相关文章:

django - 操作错误:初始同步数据库上没有这样的表

mysql - 如何提高拥有 5000 万条记录且不断增长的表的性能

sql - 在 Redshift 中使用 json_extract_path_text 时如何跳过错误?

php - 单个 mysqli_result 中的多个查询

mysql - SQL 获取聚合结果中的关联列

SQLITE 检查 id 是否具有特定值

java 这个线程设置可以工作吗?或者我做错了什么

mysql - 使用日期范围和数字过滤器连接 2 个表

sql - Coldfusion 从第二个数据源获取数据

MySQL自定义日期时间