---
title: "Querying"
canonical: https://trickest.com/docs/using-the-app/database-management/querying
description: "Filter Live Table data using the Trickest Query Language."
---

# Querying

## Overview

The **Query** tab lets you write and run filters against any Live Table. Queries use the Trickest Query Language, a concise syntax built for filtering large structured datasets with exact matches, comparisons, regex patterns, and logical operators.

## Writing a Query

Open a Live Table and click the **Query** tab. Click **New Query** to create a query, then type your filter in the text editor that opens.

{/* screenshot: query-editor-and-results */}

### Operators

| Operator | Description | Applicable types |
|----------|-------------|-----------------|
| `=` | Exact match | Strings, numbers, dates, IPs |
| `!=` | Does not match | Strings, numbers, dates, IPs |
| `>` | Greater than | Numbers, dates |
| `<` | Less than | Numbers, dates |
| `~` | Matches regex pattern | Strings |
| `!~` | Does not match regex pattern | Strings |
| `AND` | Both conditions must be true | |
| `OR` | Either condition can be true | |

### Basic examples

These examples use illustrative column names. Replace them with columns in your selected table and values of the matching type.

Exact value:
```text
status_code = 200
```

Numeric comparison:
```text
response_time > 1000
```

Exclude a value:
```text
port != 80
```

Regex match:
```text
hostname ~ ".*staging.*"
```

Multiple conditions:
```text
port = 22 AND banner ~ "OpenSSH" AND last_seen > "2024-01-01"
```

<Note>
Quote strings and dates. Leave numbers unquoted. When using regex, escape special characters with a backslash (e.g., use `\\.` to match a literal period).
</Note>

## Grouping Conditions with Parentheses

Use parentheses to control how `AND` and `OR` are evaluated when combining multiple conditions:

```text
(port = 80 OR port = 443) AND status_code = 200
```

```text
(severity = "critical" AND status = "open") OR (severity = "high" AND last_seen > "2024-01-01")
```

Keep groups simple and test the filter against records whose expected result you know before saving it. If the editor reports a syntax error, reduce the expression to one condition and add groups back one at a time.

## Running a Query

Enter a nonempty filter, then select **Run** to query the current Live Table. Results are displayed in the table below the editor. The row count updates to reflect how many records match your filter.

The query editor requires a nonempty filter to run. Use the table's browsing view when you want to inspect its unfiltered rows.

### Selecting a dataset and columns

Two dropdowns sit next to the **Run** button:

- **Live Table**: selects which Live Table in the current database to query. Switch between tables without leaving the Query tab.
- **Columns**: toggles which columns are visible in the results. Use this to focus on the fields relevant to your current filter. This does not affect the underlying data or other team members' views.

## Tips

* **Start broad, then refine.** Begin with a single condition and add more until you isolate exactly what you need.
* **Use parentheses for mixed logic.** When combining `AND` and `OR`, always use parentheses to make evaluation order explicit.

## Next Steps

<CardGroup cols={2}>
  <Card title="Creating Views" icon="table-columns" href="./creating-views">
    Save queries and column layouts as named views for quick reuse.
  </Card>
  <Card title="Exporting" icon="arrow-up-from-bracket" href="./exporting">
    Download filtered results for use in external tools and reports.
  </Card>
</CardGroup>

---
_Markdown source of https://trickest.com/docs/using-the-app/database-management/querying._
