总会有这样的时刻,突然要在表中加个字段,加个索引,或者加个字段,或者是修改给字段, 一时间想不起来用哪个命令,现在就将平时用到的一部分命令写出来,方便使用: 1.增加表中的字段 alter table tablename add new_field type not null default '0'; exa
总会有这样的时刻,突然要在表中加个字段,加个索引,或者加个字段,或者是修改给字段,
一时间想不起来用哪个命令,现在就将平时用到的一部分命令写出来,方便使用:
1.增加表中的字段
alter table tablename add new_field type not null default '0';
example:
alter table people_final_base add is_del int(11) not null default 0;
2.修改表中字段名字
alter table tablename change old_item new_item old_type;
example:
alter table people_final_base change name chinese_name varchar(50);
3.修改字段类型
alter table tablename change filed_name filed_name new_type;
example:
alter table people_final_base change create_date create_date varchar(100);
4.删除字段
alter table tablename drop column column_name;
example:
alter table people_final_base drop column temp0;
5.添加主键
alter table tablename add primary key(item);
alter table fashion_relation_partner add primary key(pps_key);
6.修改主键
思路:先删除主键,然后再添加主键
alter table tablename drop primary key;
alter table tablename add primary key(item);
example:
alter table fashion_relation_partner drop primary key;
alter table fashion_relation_partner add primary key(pps_key);
7设置字段默认值
alter table fashion_warning_work alter column is_del set default 0;
开发语言:java,支持数据库:Mysql 5,系统架构:J2EE,操作系统:linux/Windows1. 引言 32. 系统的结构 32.1 系统概述 33. 功能模块设计说明 43.1 商品管理 43.1.1 添加商品功能模块 53.1.2 商品列表功能模块 83.1.3 商品关联功能模块 93.
0
先写这些吧,后边在慢慢补上!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号