Having the following tables without keys yet defined:
Airplane (code_auto, company_code, year, motor_type, type, state)
Flight (FlightCode, FlightNumber, flightCode, CompanyCode)
In some cases, about 400 records from the airplane table, an airplane is associated with two airlines and I do not intend to do so, I intend that each airplane has only one airline. In the following scenario:
Flight code | Company code
N107AS | AS
N107AS | EV
The same plane is associated with two different airlines. It turns out that in the Flight table, when it comes to the N107AS aircraft there are 8000 records for when it is associated with company AS and 1000 for company EV.
What I want to do is remove companies where there are fewer registrations so that each plane has only one airline and the one with the most records in the flight table.
This is for the 400 cases. Is there any automated way to do this or do I have to delete them individually?