---
title: "General query syntax"
slug: "general-query-syntax"
abstract: "Overview of the Sitecore query syntax."
---
# General query syntax

The Sitecore query syntax leverages the concept of a context item and uses the following symbols to reference related items:

| Symbol | Description |
| --- | --- |
| / | The root of the content tree or a parent-child relationship. |
| text | Match by item name. |
| # | Escape text containing dashes (-) . For example: #meta-data#. It can also be used to escape special words, for example: #and#, #or#. |
| * | Wildcard, match items of any name. |
| .. | The parent of the context item. |
| [ ] | Search criteria related to fields and XML element attributes. |
| @ | A field defined in the item’s base template |
| @@ | An XML element attribute, all Sitecore items are treated as “item” elements, which contain the following attributes:<br><br><ul><li>name - the item’s name.</li><li>key - the item’s name in all lower-case characters.</li><li>id - the item’s GUID.</li><li>tid - the item’s base template’s GUID.</li><li>mid - the branch template used to create the item, if any.</li><li>sortorder - the item’s sort order.</li><li>template - the item’s base template’s name.</li><li>parentid - the item’s parent’s GUID.</li></ul> |

Combining these symbols references specific items or groups of items. For example:

| Sitecore query string | Result set |
| --- | --- |
| `/*` | The root of the content tree. |
| `/sitecore/content/home` | The Sitecore home item. |
| `/sitecore/content/home/*[startswith(@title,'P')]` | Immediate subitems under the home item that contain a **Title** field that starts with P. |

| Sitecore query string | Result set |
| --- | --- |
| `*[@ hidden='1']` | All hidden subitems underneath the context item. |
| `query: /*/content/#meta- data#/colors/*[@show='1']` | A **Source** field that selects all subitems under the *Color* item that have the **Show** check box selected. |
| `./*[@@tid="{A87A00B1-E6DB-45AB-8B54-636FEC3B5523}"]` | Subitems under the context item based on the *Folder* template. |