MySQL示例数据库(MySQL Sample Databases) 之 Employees 数据库

文章介绍了MySQL的Employees数据库,一个包含数百万条记录的大数据集,用于测试和验证MySQL性能。提供了下载、安装步骤及数据库结构,包括employees、departments、titles等表,使用InnoDB存储引擎。此外,还提及了数据加载时间及CreativeCommons授权协议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MySQL示例数据库(MySQL Sample Databases) 之 Employees 数据库

官方示例数据介绍

MySQL 官方提供了多个示例数据库,在MySQL的学习、开发和实践中具有非常重要的作用,能够帮助初学者更好地理解和应用MySQL的各种功能和特性。

官方示例数据具体列表如下:

1. employee data (large dataset, includes data and test/verification suite)
2. world database
3. world_x database
4. sakila database
5. airportdb database (large dataset, intended for MySQL on OCI and HeatWave)	
6. menagerie database

这些数据库都可以通过如下官方网址进行下载和安装

https://dev.mysql.com/doc/index-other.html

在这里插入图片描述

Employees 数据库

这是一个非常大的数据集,包含了数百万条记录,可以用于测试和验证MySQL的性能和处理大数据量的能力。 数据集包含了员工、职位、部门等信息,以及一套测试和验证用的脚本和SQL语句。

下载地址:

https://github.com/datacharmer/test_db

通过[Dowload Zip]下载test_db-master.zip压缩包。
在这里插入图片描述

Employees 数据库安装

下载压缩包后就可以解压安装了。
解压:

ubuntu@mysql-vm:~$ unzip  test_db-master.zip
Archive:  test_db-master.zip

安装:

ubuntu@mysql-vm:~/test_db-master$ mysql -u root -prootroot -t < employees.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
+-----------------------------+
| INFO                        |
+-----------------------------+
| CREATING DATABASE STRUCTURE |
+-----------------------------+
+------------------------+
| INFO                   |
+------------------------+
| storage engine: InnoDB |
+------------------------+
+---------------------+
| INFO                |
+---------------------+
| LOADING departments |
+---------------------+
+-------------------+
| INFO              |
+-------------------+
| LOADING employees |
+-------------------+
+------------------+
| INFO             |
+------------------+
| LOADING dept_emp |
+------------------+
+----------------------+
| INFO                 |
+----------------------+
| LOADING dept_manager |
+----------------------+
+----------------+
| INFO           |
+----------------+
| LOADING titles |
+----------------+
+------------------+
| INFO             |
+------------------+
| LOADING salaries |
+------------------+
+---------------------+
| data_load_time_diff |
+---------------------+
| 00:01:13            |
+---------------------+

注:在MySQL中,"-t"是命令行工具"mysql"的一个选项(或称为参数),它表示在执行查询语句后,以表格形式输出查询结果。具体来说,在执行查询语句时,使用"-t"选项会将结果按照表格的形式输出,其中每个查询结果占一行,不同的列之间用制表符"\t"分隔开。使用"-t"选项可以让查询结果更加清晰易读,方便用户阅读和分析数据。同时,MySQL还提供了其他的一些选项,例如"-u"表示用户名,"-p"表示密码等等。您可以在命令行输入"mysql --help"查看更多的选项和相关信息。

Employees 数据库的结构

安装后我们就可以使用Employees 数据库了。

mysql> use employees;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+----------------------+
| Tables_in_employees  |
+----------------------+
| current_dept_emp     |
| departments          |
| dept_emp             |
| dept_emp_latest_date |
| dept_manager         |
| employees            |
| salaries             |
| titles               |
+----------------------+
8 rows in set (0.00 sec)

Employees 数据库的结构如下:
在这里插入图片描述

注:Employees 数据库遵循"Creative Commons Attribution-Share Alike 3.0 Unported License"协议。
"Creative Commons Attribution-Share Alike 3.0 Unported License"协议是一种开放授权协议,它允许任何人在遵守一些基本条件的情况下,自由地使用、分发和修改原有作品。
其中,“Attribution”意味着署名,即在使用原有作品时必须注明其作者;“Share Alike”意味着相同方式分享,即如果更改了原作品,则衍生作品必须以同样的方式共享。这个许可协议的目的是推动知识和文化的自由交流和共享,同时保护原作者的权益和作品的完整性。

参考

https://dev.mysql.com/doc/employee/en/
mysql示例数据库 employee,这个大家也可以到github官网下载。 https://github.com/datacharmer/test_db test_db A sample database with an integrated test suite, used to test your applications and database servers This repository was migrated from Launchpad. See usage in the MySQL docs Where it comes from The original data was created by Fusheng Wang and Carlo Zaniolo at Siemens Corporate Research. The data is in XML format. http://timecenter.cs.aau.dk/software.htm Giuseppe Maxia made the relational schema and Patrick Crews exported the data in relational format. The database contains about 300,000 employee records with 2.8 million salary entries. The export data is 167 MB, which is not huge, but heavy enough to be non-trivial for testing. The data was generated, and as such there are inconsistencies and subtle problems. Rather than removing them, we decided to leave the contents untouched, and use these issues as data cleaning exercises. Prerequisites You need a MySQL database server (5.0+) and run the commands below through a user that has the following privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW Installation: Download the repository Change directory to the repository Then run mysql < employees.sql If you want to install with two large partitioned tables, run mysql < employees_partitioned.sql Testing the installation After installing, you can run one of the following mysql -t < test_employees_md5.sql # OR mysql -t < test_employees_sha.sql For example: mysql -t < test_employees_md5.sql +----------------------+ | INFO | +----------------------+ | TESTING INSTALLATION | +----------------------+ +--------------+------------------+----------------------------------+ | table_name | expected_records | expected_crc | +--------------+------------------+----------------------------------+ | employees | 300024 |
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SQLplusDB

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值