# Create

This method allows you to create a table object.

| Argument | Type     | Required | Default | Description                                                                                         |
| -------- | -------- | -------- | ------- | --------------------------------------------------------------------------------------------------- |
| table    | string   | `true`   |         | The name of the table to create.                                                                    |
| callback | function | `true`   |         | A callback function used to define the table body. It is passed a `Blueprint` as the only argument. |
| options  | struct   | `false`  | `{}`    | Options to pass to `queryExecute`.                                                                  |
| execute  | boolean  | `false`  | `true`  | Run the query immediately after building it.                                                        |

The majority of the work comes from calling methods on the `Blueprint` object. A `Blueprint` defines the [columns](/8.8.0/schema-builder/columns.md) and [indexes](broken://pages/-LA-U_axqzow_9OdzTRT) for your tables.

Example:

```javascript
schema.create( "users", function( table ) {
    table.increments( "id" );
    table.string( "email" );
    table.string( "password" );
    table.timestamp( "created_date" );
    table.timestamp( "modified_date" );
    table.timestamp( "last_logged_in" ).nullable();
} );
```

This would convert to the following SQL in MySQL:

```sql
CREATE TABLE `users` (
    `id` INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `email` VARCHAR(255) NOT NULL,
    `password` VARCHAR(255) NOT NULL,
    `created_date` TIMESTAMP NOT NULL,
    `modified_date` TIMESTAMP NOT NULL,
    `last_logged_in` TIMESTAMP,
    CONSTRAINT `pk_users_id` PRIMARY KEY (`id`)
)
```

Only one table can be created at a time. If you wanted to create multiple tables, you would call `create` multiple times.

The `callback` argument is where you define the schema of your table. It is passed a `Blueprint` object. This is commonly aliased as `table` in the callback. `Blueprint` defines the field, index and constraint methods to build your table. You can find a comprehensive list of all available methods here for [columns](https://github.com/ortus/qb/tree/b0b49b9b35032508e73231da3a39856a7bc9d21b/schema/columns.md) and here for [indexes and constraints](broken://pages/-LA-U_axqzow_9OdzTRT).


---

# 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://qb.ortusbooks.com/8.8.0/schema-builder/create.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.
