MySQL test sample data Employees

foreword

You can see the Employees database in many examples on the MySQL official website . I just learned that this database can be obtained from datacharmer/test_db today .

The database provides 6 tables with a total of 4 million data records (including 300,000 employee records and 2.8 million salary records), and the exported data is about 160MB. The database is compatible with multiple storage engines and supports partition tables.

In addition to the base data, the Employees database includes a suite of tests that can be performed on the test data to ensure the integrity of the loaded data.

These test sample data are a good choice for testing applications and database services.

For detailed introduction and usage instructions, see:

MySQL official website Employees Sample Database or Github datacharmer/test_db

Prepare

  1. To prepare the MySQL database, MySQL version 5.0+ is required, and the user is required to have the following permissions:

SELECT, INSERT, UPDATE, DELETE, 
CREATE, DROP, RELOAD, REFERENCES, 
INDEX, ALTER, SHOW DATABASES, 
CREATE TEMPORARY TABLES, 
LOCK TABLES, EXECUTE, CREATE VIEW
  1. Download the Employees database file

git clone https://github.com/datacharmer/test_db.git
cd test_db
If access to the GitHub network is slow, you can download the resources I uploaded to CSDN (test_db-1.0.7.tar.gz)
https://download.csdn.net/download/B11050729/87609110

data import

Import the employees data into the MySQL instance.

  1. Method 1: Execute the sql script file in the Windows cmd command window (or Linux terminal) to import data

F:\Chen\Data\MySQL\test_db>mysql -uroot -p1234qwer < employees.sql
Note: If the current working path is not in test_db, please give the exact path of employees.sql
  1. Method 2: In the command line window, in the mysql interactive mode, use the source command to execute the sql script file to import data

F:\Chen\Data\MySQL\test_db>mysql -uroot -p1234qwer    //登录mysql,进入mysql交互模式
mysql>source employees.sql
Note: If the current working path is not in test_db, please give the exact path of employees.sql

Execution results of method 1: (method 2 mysql interactive mode outputs too much information, it is inconvenient to take screenshots, so I won’t show it here)

说明:如果想要导入分区表,可以导入employees_partitioned.sql;

存储引擎

从上边数据导入的执行结果看,导入的数据库默认使用的是InnoDB存储引擎,如果想要使用其他存储引擎,可以修改sql文件里的存储引擎配置。

如employees.sql 文件,配置是set storage_engine = InnoDB,可以替换为其他存储引擎

/*!50503 set default_storage_engine = InnoDB */;
/*!50503 select CONCAT('storage engine: ', @@default_storage_engine) as INFO */;

MySQL支持的存储引擎如下

set default_storage_engine = InnoDB;
-- set default_storage_engine = MyISAM;
-- set default_storage_engine = Falcon;
-- set default_storage_engine = PBXT;
-- set default_storage_engine = Maria;

数据验证

test_db 提供了两种数据验证方法 md5、sha,对应SQL测试脚本test_employees_sha.sql 、test_employees_md5.sql

F:\Chen\Data\MySQL\test_db>mysql -uroot -p1234qwer -t < test_employees_md5.sql

md5验证结果:

数据库结构

下图概述了Employees数据库的结构

最后

除了 datacharmer/test_db 的 Employees 数据库,这里再推荐一个测试样例数据库 airportdb。

airportdb 数据库是一个大型数据集,旨在用于Oracle Cloud Infrastructure (OCI) 和HeatWave上的MySQL。该数据库的大小约为2GB,由14个表组成,共包含55983205条记录。

详细介绍请参考 MySQL官方文档 Setting Up the airportdb Database

下载地址:https://downloads.mysql.com/docs/airport-db.zip

Guess you like

Origin blog.csdn.net/B11050729/article/details/129733382
Recommended