Press "Enter" to skip to content

Day: September 4, 2017

MySQL示例数据库

MySQL数据库实际上提供了试验用的数据库,类似于MS SQLServer的Advancedworks示例数据库。

tips:数据库文件比较大,下载会比较慢。

#获取
git clone https://github.com/datacharmer/test_db.git
cd test_db
mysql -usujx -p
#导入数据库
mysql> source employees.sql
#数据校验
mysql> source test_employees_md5.sql;
mysql> source test_employees_sha.sql;
#提示OK之后就可以使用了
mysql> select * from departments;e
+---------+--------------------+
| dept_no | dept_name          |
+---------+--------------------+
| d009    | Customer Service   |
| d005    | Development        |
| d002    | Finance            |
| d003    | Human Resources    |
| d001    | Marketing          |
| d004    | Production         |
| d006    | Quality Management |
| d008    | Research           |
| d007    | Sales              |
+---------+--------------------+
9 rows in set (0.00 sec)

mysql> select * from employees order by birth_date desc limit 1,1;
+--------+------------+------------+-----------+--------+------------+
| emp_no | birth_date | first_name | last_name | gender | hire_date  |
+--------+------------+------------+-----------+--------+------------+
|  11157 | 1965-02-01 | Mario      | Cochrane  | M      | 1985-03-30 |
+--------+------------+------------+-----------+--------+------------+
1 row in set (0.25 sec)
mysql> select count(*) from employees;
+----------+
| count(*) |
+----------+
|   300024 |
+----------+
1 row in set (0.11 sec)