MYSQL-DDL操作




点击查看代码
```plaintext
create table  tb(
    id int comment 'ID',
    username varchar(20) comment '用户名',
    name varchar(10) comment '姓名',
    age int comment '年龄',
    gender char(1) comment '性别'
)comment 'user测试表'
</details>
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316013355841-1319451898.png)
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316013639153-725682627.png)
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316013646976-490443333.png)
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316014406245-1835387987.png)
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316014413902-1807871464.png)
<details>
<summary>点击查看代码</summary>

create table  tb(
                    id int primary key auto_increment comment 'ID',
                    username varchar(20) not null unique comment '用户名',
                    name varchar(10) not null comment '姓名',
                    age int comment '年龄',
                    gender char(1) default '男'comment '性别'
)comment 'user测试表'
</details>
**数据类型:**
数值类型
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316015912361-925504386.png)
字符串类型
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316015956113-275143266.png)
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316020022502-2071298688.png)
日期类型
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316020202306-1523481899.png)

**表操作:**
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316022340691-692226446.png)
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316022757159-1820314511.png)
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316023303119-1069704424.png)
![](https://img2024.cnblogs.com/blog/3619156/202503/3619156-20250316023310553-1117381117.png)
posted @ 2025-03-16 02:34  mooncage  阅读(15)  评论(0)    收藏  举报