如何正确格式化sqlite shell输出?

前端之家收集整理的这篇文章主要介绍了如何正确格式化sqlite shell输出?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我去 mysql shell并输入SELECT * FROM users我得到 –
+--------+----------------+---------------------------------+----------+-----------+--------------------+--------------------+
| USERID | NAME           | EMAILID                         | PASSWORD | USER_TYPE | CONTACT_ID_FKUSERS | COMPANY_ID_FKUSERS |
+--------+----------------+---------------------------------+----------+-----------+--------------------+--------------------+
|    137 | X              | b@cc.com                        | #        | ADMIN     |                166 |                110 |
|    138 | Kshitiz        | ksharma@aaa.com                 | asdf     | ADMIN     |                167 |                111 |
+--------+----------------+---------------------------------+----------+-----------+--------------------+--------------------+

Oracle sqlplus显示

USERID     NAME  EMAILID    PASSWORD   USER_TYPE  CONTACT_ID_FKUSERS COMPANY_ID_FKUSERS
---------- ----- ---------- ---------- ---------- ------------------ ------------------
137        X     b@cc.com   #          ADMIN                     166                110
137        X     b@cc.com   #          ADMIN                     166                110

sqlite shell显示

137|X|b@cc.com|#|ADMIN|166|110
138|Kshitiz|ksharma@aaa.com|asdf|ADMIN|167|111

>有没有办法美化sqlite shell的输出
>是否有一个比默认分发更好的替代shell? (仅限CLI客户端)

对于“人类可读”输出,您可以使用列模式,并打开标题输出.这将为您提供类似于示例中的sqlplus输出内容
sqlite> select * from foo;
234|kshitiz|dba.se
sqlite> .mode column
sqlite> select * from foo;
234         kshitiz     dba.se
sqlite> .headers on
sqlite> select * from foo;
bar         baz         baf
----------  ----------  ----------
234         kshitiz     dba.se
原文链接:https://www.f2er.com/sqlite/197744.html

猜你在找的Sqlite相关文章