> For the complete documentation index, see [llms.txt](https://jen-hsuan-hsieh.gitbook.io/database/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jen-hsuan-hsieh.gitbook.io/database/chapter1/12mysql-for-beginners/122beginning-with-mysql-basics/12216altering-table-structure-alter-table.md).

# 1.2.2.16.Altering Table Structure - ALTER TABLE

* 修改column
  * 例如將email改為unique

    ```
    alter table studentsdetails modify column email VARCHAR(100) unique;
    ```
  * 將email改為unique not null

    ```
    alter table studentsdetails modify column email VARCHAR(100) unique not null;
    ```

    ![](https://1088158622-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4M0G87SQJ28mvsXOhL%2F-M4M0IBPb1goOGpuG1BI%2F-M4M0Kd29z_NVwh9BUVR%2F2018041418.jpg?generation=1586302922572685\&alt=media)
