# Table

Extracts data from a database table.

```php
$etl->extract('table', 'table_name', $options);
```

## Options

### Columns

Columns that will be extracted. If `null`, all columns of the table will be extracted.

| Type  | Default value |
| ----- | ------------- |
| array | `null`        |

To select which columns will be extracted, use an array with the columns list:

```php
$options = ['columns' => ['id', 'name', 'email']];
```

### Connection

Name of the database connection to use.

| Type   | Default value |
| ------ | ------------- |
| string | default       |

```php
$options = ['connection' => 'app'];
```

### Where

Array of conditions, where `key` equals `value`. If you need more flexibility in the the query creation, you may use the [Query extractor](/docs/extractors/query.md).

| Type  | Default value |
| ----- | ------------- |
| array | `[]`          |

```php
$options = ['where' => ['status' => 'active']];
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://php-etl.gitbook.io/docs/extractors/table.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
