# Working with Columns

## addColumn(*$table*, *$column*, *$attributes*)

Add to the work queue instruction needed to add a column, named *$column*, with specified *$attributes* to *$table*.

The attributes as specified as a string, i.e. "VARCHAR(32) NOT NULL DEFAULT ''".

Returns *true* on success, or *false* on error. Additional information may be available using getLastError() and getLastErrNo().

## alterColumn(*$table*, *$column*, *$attributes*, *$newName*)

Add to the work queue instruction needed to alter an existing column, named *$column*, on *$table* with specified *$attributes*. If *$newName* is supplied, the column will be renamed as specified in *$newName*.

The attributes as specified as a string, i.e. "VARCHAR(32) NOT NULL DEFAULT ''".

Returns *true* on success, or *false* on error. Additional information may be available using getLastError() and getLastErrNo().

## getColumnAttributes(*$table*, *$column*)

Get the current attributes an existing column, named *$column*, on *$table*.

Returns an attribute string on success, or *false* on error. Additional information may be available using getLastError() and getLastErrNo().

## dropColumn(*$table*, *$column*)

Add to the work queue instruction needed to drop an existing column, named *$column*, on *$table*.

Returns *true* on success, or *false* on error. Additional information may be available using getLastError() and getLastErrNo().


---

# 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://xoops.gitbook.io/xmf-cookbook/reference/database/tables/working-with-columns.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.
