一 表的基本操作 (增删改查)
1表的创建
mysql> create table student(name varchar(20), age int);
表名 字段名 字段类型
2 表的名字的修改 rename
3 表的字段名的修改 change
mysql> alter table students change name studentname varchar(10);
表名 代码 原字段名 新字段名 新字段类型
4 表的字段类型的修改
mysql> alter table students modify age int(20);
表名 代码 字段名 新字段类型
5 表的字段的添加和删除
mysql> alter table students add id int;
表名 代码 添加的字段名 字段类型
字段的删除
mysql> alter table students drop id;
表名 代码 字段名
6 表的字段的顺序的修改
mysql> alter table students modify age int(20) first;
代码 字段字段类型 位置
First(挪动到首位)
After + 字段名 挪动到某字段的后面
7 在表中插入数据
mysql> insert into students (age) values (20);
表名 字段名 数据内容
mysql> select * from students;
查看表中的数据内容
Mysql 表的基本操作
猜你喜欢
转载自blog.csdn.net/weixin_42551781/article/details/85156281
今日推荐
周排行