sql - SQLite中如何检查一个值是否为数字

标签 sql sqlite

我有一列包含数字和其他字符串值(如“?”、“???”等)

是否可以在 SQLite 的 where 子句中添加一个“is number”条件?像这样的东西:

select * from mytable where isnumber(mycolumn)

最佳答案

来自documentation ,

The typeof(X) function returns a string that indicates the datatype of the expression X: "null", "integer", "real", "text", or "blob".

您可以使用 where typeof(mycolumn) = "integer"

关于sql - SQLite中如何检查一个值是否为数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32528759/

相关文章:

php - SQL 查询无法正常工作

java - Android:SQLite 说列不存在

sqlite - SQlite基于与两个表的最接近差异定义列(vlookup)

python - 使用 sqlite 在 python 中使用 cursor.execute 和 cursor.fetchall 的问题

sqlite - 如何仅将尚未存在于数据库中的记录保存到数据库中?

mysql - SQL JSON 数组排序

mysql - 我如何从MYSQL获取ID

mysql - 同时在多个查询中使用 RAND() 关键字

mysql - 为什么 MySQL 会返回看似与 WHERE 子句不匹配的行?

java - 显示 0 的行数