mysql数据库表的管理(增删改)

表字段管理ide

    1. 添加到末尾
spa

    alter table 表名 add 字段名 数据类型;it

    

    2 添加到开头table

    alter table  表名 add 数据类型 first;class

    

    3. 添加到指定位置date

    alter table 表名 add 新字段名 数据类型 after 原有字段名;数据类型

    

    4. 删除字段数据

    alter table 表名 drop 字段名;tab

    

    5. 修改数据类型di

    alter table 表名 modify 字段名 新数据类型;

    

    6. 修改字段名

    alter table 表名 change 旧名 新名 数据类型;

    

    7. 修改表名:

    alter table 表名 rename 新表名;


表记录管理

    1. 更新表记录

    update 表名 set 字段名=值1,字段名=值2,...;

    

    2. 删除表记录

    delete from 表名 where=条件;

    delete必须加where条件,不然将会删除全部记录

相关文章
相关标签/搜索