Найдите исполнителя для вашего проекта прямо сейчас!
Разместите заказ на фриланс-бирже и предложения поступят уже через несколько минут.

1. Create table "Employees_1" with following structure:

+-- -- -- -- -- -- +-- -- -- -- -- -- -- -+- -- -- -+- -- -- +-- -- -- -- -+- -- -- -- +

| Field | Type | Null | Key | Default | Extra |

+-- -- -- -- -- -- +-- -- -- -- -- -- -- -+- -- -- -+- -- -- +-- -- -- -- -+- -- -- -- +

| emp_no | int(11) | NO | PRI | NULL | |

| birth_date | date | NO | | NULL | |

| first_name | varchar(14) | NO | | NULL | |

| last_name | varchar(16) | NO | | NULL | |

| gender | enum('M','F') | NO | | NULL | |

| hire_date | date | NO | | NULL | |

+-- -- -- -- -- -- +-- -- -- -- -- -- -- -+- -- -- -+- -- -- +-- -- -- -- -+- -- -- -- +

2. Create table "Salaries_1" with following structure:

+-- -- -- -- -- -+- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

| Field | Type | Null | Key | Default | Extra |

+-- -- -- -- -- -+- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

| emp_no | int(11) | NO | PRI | NULL | |

| salary | int(11) | NO | | NULL | |

| from_date | date | NO | PRI | NULL | |

| to_date | date | NO | | NULL | |

+-- -- -- -- -- -+- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

3. Create table "departments_1" with following structure:

+-- -- -- -- -- -+- -- -- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

| Field | Type | Null | Key | Default | Extra |

+-- -- -- -- -- -+- -- -- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

| dept_no | char(4) | NO | PRI | NULL | |

| dept_name | varchar(40) | NO | UNI | NULL | |

+-- -- -- -- -- -+- -- -- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

4. Create table "dept_emp_1" with following structure:

+-- -- -- -- -- -+- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

| Field | Type | Null | Key | Default | Extra |

+-- -- -- -- -- -+- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

| emp_no | int(11) | NO | PRI | NULL | |

| dept_no | char(4) | NO | PRI | NULL | |

| from_date | date | NO | | NULL | |

| to_date | date | NO | | NULL | |

+-- -- -- -- -- -+- -- -- -- -- +-- -- -- +-- -- -+- -- -- -- -- +-- -- -- -+

5. Insert following records into "Employees_1":

+-- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -+- -- -- -- -+- -- -- -- -- -- -+

| emp_no | birth_date | first_name | last_name | gender | hire_date |

+-- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -+- -- -- -- -+- -- -- -- -- -- -+

| 10001 | 1953-09- 02 | Georgi | Facello | M | 1986-06- 26 |

| 10002 | 1964-06- 02 | Bezalel | Simmel | F | 1985-11- 21 |

+-- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -+- -- -- -- -+- -- -- -- -- -- -+

6. Insert following records into "Salaries_1":

+-- -- -- -- +-- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -- +

| emp_no | salary | from_date | to_date |

+-- -- -- -- +-- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -- +

| 10001 | 60117 | 1986-06- 26 | 1987-06- 26 |

| 10001 | 62102 | 1987-06- 26 | 1988-06- 25 |

| 10002 | 71963 | 2000-08- 02 | 2001-08- 02 |

| 10002 | 72527 | 2001-08- 02 | 9999-01- 01 |

+-- -- -- -- +-- -- -- -- +-- -- -- -- -- -- +-- -- -- -- -- -- +

7. Insert following records into "departments_1":

+-- -- -- -- -+- -- -- -- -- -- -- +

| dept_no | dept_name |

+-- -- -- -- -+- -- -- -- -- -- -- +

| d005 | Development |

| d007 | Sales |

+-- -- -- -- -+- -- -- -- -- -- -- +

8. Insert following records into "dept_emp_1":

+-- -- -- -- +-- -- -- -- -+- -- -- -- -- -- -+- -- -- -- -- -- -+

| emp_no | dept_no | from_date | to_date |

+-- -- -- -- +-- -- -- -- -+- -- -- -- -- -- -+- -- -- -- -- -- -+

| 10001 | d005 | 1986-06- 26 | 9999-01- 01 |

| 10002 | d007 | 1996-08- 03 | 9999-01- 01 |

+-- -- -- -- +-- -- -- -- -+- -- -- -- -- -- -+- -- -- -- -- -- -+

9. Select all from "Employees_1" only those records which have gender = 'M'

10. Select all from "Employees_1" only those employees who have salary > 70000

11. Select total and average salary of the employee with emp_no = 10002

12. Select employees first and last name with their total salaly, ordered by the first

and last name in descending order

13. Select only the employee who belongs to department "Sales"

14. Select the employees with total salaries, but only those employees who have

min(salary) more than 70000;

Результаты вбиваем через сайт: https://www.w3schools.com/sql/default.asp  -- и принтскринем 

7 лет назад
guest_15033408541804
7 лет в сервисе
Был
7 лет назад