HSQLDB 的大型示例数据库?

发布于 2024-12-06 14:06:14 字数 260 浏览 1 评论 0原文

我正在学习数据库课程,我想要一个大型示例数据库来进行实验。我在这里对“大”的定义是数据库中有足够的数据,因此如果我尝试执行效率非常低的查询,我将能够通过执行所需的时间来判断。我已经用 google 搜索过这个内容,但没有找到任何特定于 HSQLDB 的内容,但也许我使用了错误的关键字。基本上我希望找到一些已经设置好的东西,包括表、主键等以及标准化的东西,这样我就可以在一个有点现实的数据库上尝试。对于 HSQLDB,我想这只是 .script 文件。无论如何,如果有人知道这方面的任何资源,我将非常感激。

I'm taking a database class and I'd like to have a large sample database to experiment with. My definition of large here is that there's enough data in the database so that if I try a query that's very inefficient, I'll be able to tell by the amount of time it takes to execute. I've googled for this and not found anything that's HSQLDB specific, but maybe I'm using the wrong keywords. Basically I'm hoping to find something that's already set up, with the tables, primary keys, etc. and normalized and all that, so I can try things out on a somewhat realistic database. For HSQLDB I guess that would just be the .script file. Anyway if anybody knows of any resources for this I'd really appreciate it.

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

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

发布评论

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

评论(1

橙味迷妹 2024-12-13 14:06:14

您可以使用 MySQL Sakila 数据库架构和数据(开源,在 MySQL 网站上),但需要修改架构定义。您可以删除实验不需要的视图和触发器定义。例如:

CREATE TABLE country (
  country_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
  country VARCHAR(50) NOT NULL,
  last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY  (country_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

修改:

CREATE TABLE country (
  country_id SMALLINT GENERATED BY DEFAULT AS IDENTITY,
  country VARCHAR(50) NOT NULL,
  last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY  (country_id)
)

HSQLDB的MYS语法模式支持部分MySQL DDL语法,例如AUTO_INCRMENT翻译为IDENTITY,但其他的需要手动编辑。除了一些二进制字符串之外,数据大部分是兼容的。

您需要使用报告查询时间的工具来访问数据库。当查询输出处于文本模式时,HSQLDB DatabaseManager 会执行此操作。

You can use the MySQL Sakila database schema and data (open source, on MySQL web site), but you need to modify the schema definition. You can delete the view and trigger definitions, which are not necessary for your experiment. For example:

CREATE TABLE country (
  country_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
  country VARCHAR(50) NOT NULL,
  last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY  (country_id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

modified:

CREATE TABLE country (
  country_id SMALLINT GENERATED BY DEFAULT AS IDENTITY,
  country VARCHAR(50) NOT NULL,
  last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY  (country_id)
)

Some MySQL DDL syntax is supported in the MYS syntax mode of HSQLDB, for example AUTO_INCREMENT is translated to IDENTITY, but others need manual editing. The data is mostly compatible, apart from some binary strings.

You need to access the database with a tool that reports the query time. The HSQLDB DatabaseManager does this when the query output is in Text mode.

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