Skip to content

Commit 49bdd4e

Browse files
refactor 1355
1 parent b6e5e39 commit 49bdd4e

File tree

1 file changed

+0
-64
lines changed

1 file changed

+0
-64
lines changed

Diff for: database/_1355.sql

-64
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,3 @@
1-
--1355. Activity Participants
2-
--
3-
--Table: Friends
4-
--
5-
--+---------------+---------+
6-
--| Column Name | Type |
7-
--+---------------+---------+
8-
--| id | int |
9-
--| name | varchar |
10-
--| activity | varchar |
11-
--+---------------+---------+
12-
--id is the id of the friend and primary key for this table.
13-
--name is the name of the friend.
14-
--activity is the name of the activity which the friend takes part in.
15-
--Table: Activities
16-
--
17-
--+---------------+---------+
18-
--| Column Name | Type |
19-
--+---------------+---------+
20-
--| id | int |
21-
--| name | varchar |
22-
--+---------------+---------+
23-
--id is the primary key for this table.
24-
--name is the name of the activity.
25-
--
26-
--
27-
--Write an SQL query to find the names of all the activities with neither maximum, nor minimum number of participants.
28-
--
29-
--Return the result table in any order. Each activity in table Activities is performed by any person in the table Friends.
30-
--
31-
--The query result format is in the following example:
32-
--
33-
--Friends table:
34-
--+------+--------------+---------------+
35-
--| id | name | activity |
36-
--+------+--------------+---------------+
37-
--| 1 | Jonathan D. | Eating |
38-
--| 2 | Jade W. | Singing |
39-
--| 3 | Victor J. | Singing |
40-
--| 4 | Elvis Q. | Eating |
41-
--| 5 | Daniel A. | Eating |
42-
--| 6 | Bob B. | Horse Riding |
43-
--+------+--------------+---------------+
44-
--
45-
--Activities table:
46-
--+------+--------------+
47-
--| id | name |
48-
--+------+--------------+
49-
--| 1 | Eating |
50-
--| 2 | Singing |
51-
--| 3 | Horse Riding |
52-
--+------+--------------+
53-
--
54-
--Result table:
55-
--+--------------+
56-
--| results |
57-
--+--------------+
58-
--| Singing |
59-
--+--------------+
60-
--
61-
--Eating activity is performed by 3 friends, maximum number of participants, (Jonathan D. , Elvis Q. and Daniel A.)
62-
--Horse Riding activity is performed by 1 friend, minimum number of participants, (Bob B.)
63-
--Singing is performed by 2 friends (Victor J. and Jade W.)
64-
651
--# Write your MySQL query statement below
662
select activity from Friends group by activity
673
having count(id) not in

0 commit comments

Comments
 (0)