Creating an admin menu item can done via any extension type (plugins, components, modules, etc) because you can do it as part of an "install script" (which any extension type can include).
The key thing to note here is that you create the menu item by adding a row to the #__menus database when you first install the extension. The menu is not being "injected" in to the menu on the fly or anything like that. If you uninstall the extension you'd want to make sure deleting that row from #__menus is part of the delete process (which is also done via the install script). Otherwise the menu item would remain even if the extension is gone.
So the install script will get you your menu item. The next decision is how you want the request (the db query + export) to be handled when the link in the menu is clicked. The answer to that will determine if you want to use a plugin or a component.
If you try to do it as a plugin extension you'd probably need to make it part of the System plugin group and have it sniff for whatever link you used before Joomla does it's internal routing. aka, you'd want to sniff for GET request variables inside a onAfterInitialise() method.
Eg:
if you decide to make the menu link's URL be:
"administrator/index.php?option=someComponentName&view=doExport"
You'd have your System plugin sniff for those request variables (ie, sniff for when option=="someComponentName" and view=="doExport") and, when found, do your query/export action. If you set your headers correctly you'd end up with a file download request of the csv file after clicking the link.
Pros/Cons:
- Pro: A tiny bit easier than making a component.
- Con: You shouldn't have the link do anything else beside execute a file download request or redirect to some existing page. Ie, if you wanted to load a page with more options before executing the request, it wouldn't be appropriate to do via a plugin (it's possible to do, just not what plugins are made for).
- Con: This plugin will be called for every page load front end and back end. It's small overhead but it's is still overhead on every page load. This is a good reason not to use a plugin.
The other option (and the one I'd recommend) is to use a component extension instead. You'd only need the 'admin' side (your 'site' side of the component can just be a blank index.html file).
Pros/Cons
- Pro: Way more freedom to develop how you want. You can make a page with additional options before executing the export or you have it just export like with the plugin option.
- Con: If all your wanting to do is export the csv when the menu link is clicked then this method might be very slightly more involved.
I'd go the component route if I were you. It's more in line with the heart of what you're trying to do.