What's the meaning of hard code query
Your code seems working well. In software development, "hard code" or "hard coding" can be interpreted as "embedding your external data like SQL statement directly to your source code".

Reference:

Hard coding

Soft coding