Skip to content

Commit b0219a2

Browse files
refactor 1076
1 parent 0707742 commit b0219a2

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

database/_1076.sql

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,3 @@
1-
--1076. Project Employees II
2-
--
3-
--Table: Project
4-
--
5-
--+-------------+---------+
6-
--| Column Name | Type |
7-
--+-------------+---------+
8-
--| project_id | int |
9-
--| employee_id | int |
10-
--+-------------+---------+
11-
--(project_id, employee_id) is the primary key of this table.
12-
--employee_id is a foreign key to Employee table.
13-
--Table: Employee
14-
--
15-
--+------------------+---------+
16-
--| Column Name | Type |
17-
--+------------------+---------+
18-
--| employee_id | int |
19-
--| name | varchar |
20-
--| experience_years | int |
21-
--+------------------+---------+
22-
--employee_id is the primary key of this table.
23-
--
24-
--
25-
--Write an SQL query that reports all the projects that have the most employees.
26-
--
27-
--The query result format is in the following example:
28-
--
29-
--Project table:
30-
--+-------------+-------------+
31-
--| project_id | employee_id |
32-
--+-------------+-------------+
33-
--| 1 | 1 |
34-
--| 1 | 2 |
35-
--| 1 | 3 |
36-
--| 2 | 1 |
37-
--| 2 | 4 |
38-
--+-------------+-------------+
39-
--
40-
--Employee table:
41-
--+-------------+--------+------------------+
42-
--| employee_id | name | experience_years |
43-
--+-------------+--------+------------------+
44-
--| 1 | Khaled | 3 |
45-
--| 2 | Ali | 2 |
46-
--| 3 | John | 1 |
47-
--| 4 | Doe | 2 |
48-
--+-------------+--------+------------------+
49-
--
50-
--Result table:
51-
--+-------------+
52-
--| project_id |
53-
--+-------------+
54-
--| 1 |
55-
--+-------------+
56-
--The first project has 3 employees while the second one has 2.
57-
58-
--# Write your MySQL query statement below
591
select project_id from Project
602
group by project_id
613
having count(employee_id) =

0 commit comments

Comments
 (0)