SQLite 数据库与 Squirrel:没有关系

发布于 2025-01-07 21:18:15 字数 1295 浏览 0 评论 0原文

我拥有的:

我有一个带有连接的 SQLite 数据库。下面是 sql 创建代码的一小部分(目的地和 log_entries 表之间的多对多连接):

DROP TABLE IF EXISTS "destinations";
CREATE TABLE "destinations" (
"ID_destination" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE , "name" VARCHAR NOT      NULL , "time_period" INTEGER NOT NULL , "details" TEXT
 );

DROP TABLE IF EXISTS "log_entries_destinations";
CREATE TABLE "log_entries_destinations" (
"ID_log_entries_destinations" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE ,     "ID_destination" INTEGER NOT NULL , "ID_log_entry" INTEGER NOT NULL
,FOREIGN KEY(ID_log_entry) REFERENCES log_entries(ID_log_entry)
,FOREIGN KEY(ID_destination) REFERENCES destinations(ID_destination)
);


DROP TABLE IF EXISTS "log_entries";
CREATE TABLE "log_entries" (
"ID_log_entry" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE , "timestamp"    DATETIME NOT NULL
);

您可以看到,我已经定义了与外键的关系。

对于 Firefox Addin 中的数据库,SQLite Manager 我已在“On-connect SQL”选项卡中设置了以下键:*PRAGMAforeign_keys=ON;*

我的问题是什么: 因为我不太擅长复杂的SQL查询编写,所以我必须在图形工具中设计查询。我的决定是松鼠。我已经下载了 SQLite 的 JDBC 驱动程序。

在 SQuirreL 中,当我将所有表格发送到图表时,我看不到它们之间的关系。也在查询生成器工具上。有人使用 SQLite-Squirrel 组合的经验吗? SQLite 是否存在任何替代查询设计器工具?或者最简单的方法是在 Access 中运行 SQL 创建脚本,并在那里设计查询?

What I have:

I have an SQLite database with connections. Here is a little part of the sql create code (A many-to-many connection between destinations and log_entries table):

DROP TABLE IF EXISTS "destinations";
CREATE TABLE "destinations" (
"ID_destination" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE , "name" VARCHAR NOT      NULL , "time_period" INTEGER NOT NULL , "details" TEXT
 );

DROP TABLE IF EXISTS "log_entries_destinations";
CREATE TABLE "log_entries_destinations" (
"ID_log_entries_destinations" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE ,     "ID_destination" INTEGER NOT NULL , "ID_log_entry" INTEGER NOT NULL
,FOREIGN KEY(ID_log_entry) REFERENCES log_entries(ID_log_entry)
,FOREIGN KEY(ID_destination) REFERENCES destinations(ID_destination)
);


DROP TABLE IF EXISTS "log_entries";
CREATE TABLE "log_entries" (
"ID_log_entry" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  UNIQUE , "timestamp"    DATETIME NOT NULL
);

You can see, I have defined the relationships with foreign keys.

For the db in the Firefox Addin, SQLite Manager I have setted in "On-connect SQL" tab the following key: *PRAGMA foreign_keys=ON;*

What is my problem:
Because I am not so good in complex SQL query writing, I have to design queries in graphic tool. My decision was the SQuirreL. I have downloaded the JDBC driver for SQLite.

In SQuirreL when I send all of the tables to the graph, I can't see the're relations. On Query Builder tool too. Has anybody experience with SQLite-Squirrel combo? Exists any alternative query designer tool for sqlite? Or the simplest way is run the SQL creator script in Access for example, and design queries there?

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

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

发布评论

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

评论(1

长亭外,古道边 2025-01-14 21:18:15

我建议不要使用查询生成器工具;从长远来看,如果您现在咬紧牙关并努力编写前一两个查询,那么从长远来看,这对您来说会容易得多……您很快就会掌握窍门。

另一种选择是永远尝试让您的查询生成器工具精确地执行您想要的操作......这可能是一个真正令人头痛的问题。

I would suggest not using a query builder tool; it will be a lot easier for you in the long run if you bite the bullet now and struggle writing your first one or two queries... you'll quickly get the hang of it.

The alternative would be forever trying to get your query builder tool to do precisely what you want it to... which can be a real headache.

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