> For the complete documentation index, see [llms.txt](https://a.b.cr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://a.b.cr/dictionary/alphabet/mysql.md).

# MySQL

## Usage

### Alter table

#### Add a column to a table

We can add a column to a table with a specified order with the keyword `FIRST` to the front of all columns or `` AFTER `exist_column_name` `` to after the column `` `exist_column_name` ``.

```sql
ALTER TABLE `table_name` ADD COLUMN `new_column_name` VARCHAR ( 255 ) NOT NULL DEFAULT '' COMMENT 'some_comments' AFTER `exist_column_name`;
```

#### Change the data type of a column

```sql
ALTER TABLE `table_name` MODIFY COLUMN `exist_column_name` VARCHAR ( 255 ) NOT NULL DEFAULT '' COMMENT 'some_comments';
```
