Write a request that will select the name of the event (events.caption), for which more than three applications.
There are two tables
first events table
- id captoin
- 1 first
- 2 second
3 thirdth
second table bids
id id_event name
1 1 aa
- 2 2 bb
- 3 2 cc
- 4 2 dd
- 5 2 ee
- 6 1 ff
SELECT id_event, COUNT(id_event) AS cnt FROM bids GROUP BY id_event HAVING cnt NOT BETWEEN 0 AND 3; Here is the query to display id_event (2) and the number of cnt4
- id_event cnt
- 2 4
That is, it remains only to compare the variables id (from the events table) and id_event (from the bids table) so that the output will be the name of the event.