Experiment 4 3-group by data query, etc.

Experiment 4 database queries

First, the  Experiment:

1, Group by statement

2, Having Statement

3, Order by the statement

4, Limit statement

5, Union statement

6, Handler statement

Second, the  pilot project: staff management database

Staff management for enterprise database management, database named YGGL in, YGGL database consists of three tables: Employees (employee information table), Departments (department information table), Salary (staff salaries Fact Sheet).

Third, the  experimental procedures required to complete the following :( command)

1, by department employees working in the sector;

 

 

2, respectively, statistics males and female employees;

 

 

3, find the name of the department and the number of employees number of employees more than two people;

 

 

4, grouped according to statistics the number of academic staff of various qualifications;

 

 

5, according to staff qualifications, gender statistics, the number of all kinds of education;

 

 

Number 6, according to staff qualifications, various degrees of gender statistics and produces a result set, including the number of male workers for each degree, the number of female workers, the total number;

 

 

7, by gender, statistics department number the number of departments, including the number of employees in each department male and female number of employees and the total number;

 

 

8, look for the number of workers than male department No. 2, the number of male workers;

 

 

9, the employee information sorted in descending order by date of birth;

 

 

10, the number of employees paid by revenue from small to large;

 

 

11, according to years of service packets, people counting each working years, and in accordance with the number of small to large;

 

 

12. Find five records from the beginning of Article 3 records employee information table;

 

 

13, find the number of employees is greater than the income of male workers in 2000, the name, income, claim 5 rows before the show;

 

 

14, employee name query information from the employee table, gender, query department number, department name from the department information table and two union query results into a single result set;

 

 

15, the query from the employee information table employee number, name, query department number, department name from the department information table and two union query results into a single result set, the result will be sorted according to staff number, to display the result set the first 15 records;

 

 

16, using the handler open the employee information table, ask to see the first record department number 4;

 

 

17、使用handler打开员工信息表,要求查看工作年限超过3年的前4条记录;

 

 

18、使用handler关闭员工信息表。

 

 

四、  实验报告要求

1、 实验报告格式要求

包括内容:标题、实验内容、实验步骤、实验中遇到的问题及解决方案

2、 实验报告内容要求

(1)     标题参看实验指导标题+“实验报告”,如“实验一 MySQL的安装与命令初步实验报告”;

(2)     实验内容与实验指导中相同;

(3)     实验步骤中将自己实验中的每个步骤的命令和操作结果显示界面进行截图完善。

(4)     实验中遇到的问题及解决方案中如实地将自己的问题的解决过程记录出来。

3、 实验报告提交要求

每次实验课结束之后,每个人需要提交实验报告,实验报告命名为:学号姓名 

五、  补充说明

实验报告的提交和完成情况将作为期末考评的一部分,希望每位同学认真完成每次安排的实验,并按要求按时提交实验报告。

 

Guess you like

Origin www.cnblogs.com/lvwuwa/p/11128260.html