Sharepoint administrators and database administrators use lot of sql queries to get results that are not available via web part or other Sharepoint out of box tool.
But please note that Microsoft doesn't recommends querying the Sharepoint database directly. I heard you saying that it is just a simple select query and not a change to the database which is strict NO!
But still some of the issues that may pop up if you are executing SQL queries on Sharepoint Databases are but not limited to;
- This is completely unsupported by the EULA you agreed to when you installed SharePoint.
- Your queries are not guaranteed to work after applying any patches or service packs to SharePoint since Microsoft could change the database schema anytime.
- Directly querying the database can place extra load on a server and hence performance issues.
- Direct SELECT statements against the database take shared read locks at the default transaction level so your custom queries might cause deadlocks and hence stability issues.
- Your custom queries might lead to incorrect data being retrieved.
- The query may end up in deadlock of other Sharepoint transaction.