404 means the server cannot find the requested resource. In the case of a database, the "resource" is the database endpoint.
So, 404 would be used in case the database endpoint does not exist at the URL you tried to access it at. A query returning zero rows would be a "success" in HTTP terms.