简体   繁体   English

如何使用.schema文件在sqlite3中创建数据库文件

[英]How to create a DB file in sqlite3 using a .schema file

Our client has provided us with a file named db.schema. 我们的客户为我们提供了一个名为db.schema的文件。 Now is there a command which I can use to run this file to create a .db file in sqlite3? 现在是否有一个命令可以用来运行这个文件来在sqlite3中创建一个.db文件? Can I do this without having to type in all the queries mentioned in the db.schema file? 我可以这样做而无需输入db.schema文件中提到的所有查询吗?

Please help! 请帮忙! Thanks! 谢谢!

If that file contains only SQL commands in the correct format, get the sqlite3 command-line tool, and run it like this: 如果该文件仅包含格式正确的SQL命令,请获取sqlite3命令行工具,并按以下方式运行:

sqlite3 mydatabase.db < db.schema

Many SQLite administration tools also have functions to import such a file. 许多SQLite管理工具还具有导入此类文件的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM