---
title: Database query naming
source: https://docs.newrelic.com/docs/apm/agents/net-agent/custom-instrumentation/query-naming
---

New Relic .NET agent instruments and groups your application's SQL queries. Normally, the .NET agent will automatically assign a name to a query based on the properties of the query. Alternatively, you can assign a custom name to a query.

## How to name a query [#name-query]

All SQL versions supported by our .NET agents can be given a custom name.

To give a name to a query, you add a comment to the query text with a format like `/* NewRelicQueryName: myQueryName */`. Here's an example of adding that to an app's code:

```cs
var connection = new MySqlConnection(mySqlConnectionString);
var command = new MySqlCommand("/* NewRelicQueryName: My query name */ SELECT date FROM dates", connection);
```

## Find named queries [#find-named-query]

Your database and query data can be found on the [**Databases** UI page](https://docs.newrelic.com/docs/apm/apm-ui-pages/monitoring/databases-page-view-operations-throughput-response-time). A named query will appear with its name in brackets. Here's an example of that:

![named_query.png](https://docs.newrelic.com/images/apm_screenshot-crop_screenshot-showing-where-you-would-see-a-custom-query-name.webp "named_query.png")

## Troubleshooting

Not seeing your query data in New Relic? See our troubleshooting docs.
