---
title: Query a Table
sidebarTitle: Query a Table
---

## Description

The `query()` function is executed on a data source connected to MindsDB and saved into a variable. It queries a table from this data source.

## Syntax

Here is the syntax:

```sql
my_data_source.query('SELECT * FROM my_table LIMIT 100')
```

You can query for newly added data using the functionality introduced by the [`LAST` keyword](/mindsdb_sql/sql/create/jobs#last) as follows:

```sql
query = server.databases.my_data_source.tables.table_name.filter(column_name='value').track('timestamp_column')

# first call returns no records
df = query.fetch()

# second call returns rows with timestamp_column greater than the timestamp of a previous fetch
df = query.fetch()
```
