Delete companies with the least number of flights
If you can with MySQL 8.0, use the WITH Common Table Expression to simplify this query.
https://dev.mysql.com/doc/refman/8.0/en/with.html
The idea is to extract out the nested queries into ones in the WITH statement before the main query and then use them just like tables in the main query.