如何显示“ null”(sqlite)

发布于 2025-01-29 16:31:21 字数 636 浏览 2 评论 0原文

sqlite 上,我显示了表“用户” ,如下所示,但“ null” 未显示,因此我无法区分” null“ 空白(空字符串)

sqlite> .header on
sqlite> .mode box
sqlite> select * from user;
┌────┬─────────────────┐
│ id │      name       │
├────┼─────────────────┤
│ 1  │ Steve Jobs      │
│ 2  │                 │ <- Null
│ 3  │                 │ <- Null
│ 4  │ Bill Gates      │
│ 5  │                 │ <- Blank(Empty String)
│ 6  │ Mark Zuckerberg │
└────┴─────────────────┘

有什么方法可以显示“ null”

On SQLite, I displayed the table "user" as shown below but "Null" is not displayed so I cannot differentiate between "Null" and Blank(Empty String):

sqlite> .header on
sqlite> .mode box
sqlite> select * from user;
┌────┬─────────────────┐
│ id │      name       │
├────┼─────────────────┤
│ 1  │ Steve Jobs      │
│ 2  │                 │ <- Null
│ 3  │                 │ <- Null
│ 4  │ Bill Gates      │
│ 5  │                 │ <- Blank(Empty String)
│ 6  │ Mark Zuckerberg │
└────┴─────────────────┘

Are there any ways to display "Null"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十秒萌定你 2025-02-05 16:31:21

下面的此命令可以设置为null值显示的内容:

.nullvalue <String>

因此,SET null如下所示:

.nullvalue NULL

然后,为显示,null。 null值如下所示:

sqlite> .headers on
sqlite> .mode box
sqlite> SELECT * FROM person;
┌────┬─────────────────┐
│ id │      name       │
├────┼─────────────────┤
│ 1  │ Steve Jobs      │
│ 2  │ NULL            │ <- NULL
│ 3  │ NULL            │ <- NULL
│ 4  │ Bill Gates      │
│ 5  │                 │ <- Blank(Empty String)
│ 6  │ Mark Zuckerberg │
└────┴─────────────────┘

下一步,set 这是null。,如下所示:

.nullvalue "This is NULL."

然后,这是null,用于null >如下所示的值:

sqlite> .headers on
sqlite> .mode box
sqlite> SELECT * FROM person;
┌────┬─────────────────┐
│ id │      name       │
├────┼─────────────────┤
│ 1  │ Steve Jobs      │
│ 2  │ This is NULL.   │ <- NULL
│ 3  │ This is NULL.   │ <- NULL
│ 4  │ Bill Gates      │
│ 5  │                 │ <- Blank(Empty String)
│ 6  │ Mark Zuckerberg │
└────┴─────────────────┘

下面的这些命令可以显示命令.nullvalue

.help .nullvalue

或:

.help nullvalue

然后,这就是下面的样子:

sqlite> .help .nullvalue  
.nullvalue STRING        Use STRING in place of NULL values

This command below can set what to show for NULL values:

.nullvalue <String>

So, set NULL as shown below:

.nullvalue NULL

Then, NULL is displayed for NULL values as shown below:

sqlite> .headers on
sqlite> .mode box
sqlite> SELECT * FROM person;
┌────┬─────────────────┐
│ id │      name       │
├────┼─────────────────┤
│ 1  │ Steve Jobs      │
│ 2  │ NULL            │ <- NULL
│ 3  │ NULL            │ <- NULL
│ 4  │ Bill Gates      │
│ 5  │                 │ <- Blank(Empty String)
│ 6  │ Mark Zuckerberg │
└────┴─────────────────┘

Next, set This is NULL. as shown below:

.nullvalue "This is NULL."

Then, This is NULL is displayed for NULL values as shown below:

sqlite> .headers on
sqlite> .mode box
sqlite> SELECT * FROM person;
┌────┬─────────────────┐
│ id │      name       │
├────┼─────────────────┤
│ 1  │ Steve Jobs      │
│ 2  │ This is NULL.   │ <- NULL
│ 3  │ This is NULL.   │ <- NULL
│ 4  │ Bill Gates      │
│ 5  │                 │ <- Blank(Empty String)
│ 6  │ Mark Zuckerberg │
└────┴─────────────────┘

And, these commands below can show the details of the command .nullvalue:

.help .nullvalue

Or:

.help nullvalue

Then, this is how it looks like below:

sqlite> .help .nullvalue  
.nullvalue STRING        Use STRING in place of NULL values
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文