Hello,
Well, undoubtedly, using an in-memory array will be much faster than retrieving data from your database (though it would not take long). However, that means that you would have the list of countries/country codes hard-coded instead of having them in the database and reload them dynamically.
In the case of countries, the list won't change tomorrow

, so I think you can afford to hard-code it. Now, if you already have a MySQL database, creating a table and then execute queries on it won't be too heavy in this case. The second solution is cleaner and I may prefer this one. However, you will lose in terms of performance : in-memory work is always faster. Moreover, though in a non-web environment the difference may be unnoticeable with such a query, remember that if you use a table in a web environment, you will have to
reload the page when you execute the query so as to reach the MySQL server, while you wouldn't have to if the list was hard-coded.
Now the choice is yours.
Regards,
RBARAER