如何以编程方式查看添加到表中的列
我创建了一个名为 test.sqlite 的数据库。我添加了一个名为 Coffee 的表,并以编程方式向其中添加列,当我运行程序时,它会成功执行。但我想在 sqlite 命令提示符中看到我以编程方式添加的列。怎么可能呢?在sqlite命令提示符中查看数据库中表的数量的命令是什么?
I have created a database named test.sqlite .In that I have added a table named coffee and I am adding columns to it programmatically and when I run my program it executes successfully. But I want to see in the sqlite command prompt the columns that I have added programmatically. How is it possible? And what is the command to see the no of tables in the database in sqlite command prompt?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 sqlite_master 表获取数据库中所有对象的列表(表、视图、索引等):
使用 pragma 获取表的列列表:
Use the sqlite_master table to get a list of all the objects in the database (table, views, indexes, etc.):
Use the pragma to get the list of columns for a table:
打开终端窗口,导航到包含 test.sqlite 的目录,然后在命令行中键入:
yourname$ sqlite3 test.sqlite
SQLite 将启动并为您提供一个命令提示符,您可以在其中键入.dump命令查看数据库的整个结构:
sqlite> .dump
您还可以使用.help 命令来查找查看数据的其他方法。或者,阅读 sqlite3 的手册页。
Open a terminal window, navigate to the directory containing test.sqlite, and at the command line, type:
yourname$ sqlite3 test.sqlite
SQLite will start up and give you a command prompt at which you can type the .dump command to see the entire structure of the database:
sqlite> .dump
You can also use the .help command to find other ways to look at your data. Or, read the man page for sqlite3.