如何使用 .schema 文件在 sqlite3 中创建数据库文件 [英] How to create a DB file in sqlite3 using a .schema file

查看:50
本文介绍了如何使用 .schema 文件在 sqlite3 中创建数据库文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的客户为我们提供了一个名为 db.schema 的文件.现在是否有一个命令可以用来运行此文件以在 sqlite3 中创建 .db 文件?我可以在不必输入 db.schema 文件中提到的所有查询的情况下执行此操作吗?

Our client has provided us with a file named db.schema. Now is there a command which I can use to run this file to create a .db file in sqlite3? Can I do this without having to type in all the queries mentioned in the db.schema file?

请帮忙!谢谢!

推荐答案

如果该文件仅包含正确格式的 SQL 命令,请获取 sqlite3 命令行工具,并像这样运行它:

If that file contains only SQL commands in the correct format, get the sqlite3 command-line tool, and run it like this:

sqlite3 mydatabase.db < db.schema

许多 SQLite 管理工具也具有导入此类文件的功能.

Many SQLite administration tools also have functions to import such a file.

这篇关于如何使用 .schema 文件在 sqlite3 中创建数据库文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆