数据库----(MySQL基本常见sql)
来源:互联网 发布:java开发常用工具 编辑:程序博客网 时间:2024/06/05 08:27
删除唯一索引:
alter table T_PARTY_REG drop index UK_T_PARTY_REG_REG_CODE;
新建索引:
create index IX_T_PARTY_REG_REG_CODE on DBUSER.T_PARTY_REG
(
REG_CODE
);
修改列属性定义:
alter table T_PARTY_REG modify LOGIN_PWD VARCHAR(50) comment ‘登录密码’;
修改列名:
alter table T_PARTY_REG change COM_ID TENANT_ID INT(5) comment ‘租户ID’;
表重命名:
alter table ENT_BASEINFO rename T_ENT;
表增加列至指定行后面:
alter table DBUSER.T_PARTY_REG add SIGNATURE VARCHAR(200) comment ‘签名’ after ACCOUNT_STATUS;
说明:第一行为:alter table t1 add column addr varchar(20) not null first;
表删除列:
alter table dbuser.D_BANK_HEAD drop column PIC_URL;
表删除主键:
Alter table t_order_log drop primary key;
alter table DBUSER.T_PARTY_LOGIN_HISTORY drop foreign key FK_Reference_6;
表增加主键:
Alter table T_PDT_EXTEND add primary key(PDT_ID);
查看表存在的约束:
select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where table_name = ‘t_ent’;
删除外键约束:
alter table DBUSER.T_PARTY_LOGIN_HISTORY drop foreign key FK_Reference_6;
alter table DBUSER.T_PARTY_LOGIN_HISTORY drop key FK_Reference_6;
修改主键自增:
mysql> alter table tb1 change id id int not null primary key auto_increment; –存在主键无法设置自增
ERROR 1068 (42000): Multiple primary key defined
mysql> Alter table tb1 drop primary key;
Query OK, 10 rows affected (0.20 sec)
Records: 10 Duplicates: 0 Warnings: 0
mysql> alter table tb1 change id id int not null primary key auto_increment;
Query OK, 10 rows affected (0.19 sec)
Records: 10 Duplicates: 0 Warnings: 0
更改表字段备注信息:
update information_schema.columns t set t.column_comment = ‘注释’
where t.table_schema=’数据库名’
and t.table_name=’表名’
and t.column_name=’列名’;
删除自增:
Alter table tb1 change id id int;
修改表引擎方法
alter table table_name engine=innodb;
- 数据库----(MySQL基本常见sql)
- mysql数据库常见基本操作
- MySQL数据库——常见基本操作
- MySQL数据库学习笔记(三)----基本的SQL语句
- MySQL数据库中SQL语句的基本使用(一)
- MySQL数据库中SQL语句的基本使用(二)
- MySQL数据库中SQL语句的基本使用(三)
- MySQL数据库、数据表的基本操作(sql语句)
- Mysql数据库的基本sql语句
- 数据库之常见SQL问题和基本规则
- MySql的基本用法(2)_常见的数据库操作
- mysql数据库常用的基本SQL语句--数据库表操作
- mysql数据库常用的基本SQL语句--数据库数据操作
- Mysql数据库与sql语言(二)--数据库的基本操作
- 数据库(SQL基本操作)
- 数据库(SQL基本操作)
- 常见数据库Sql Server,Oracle和MySQL的分页语句
- sql server,mysql与oracle常见数据库的分页查询
- (WEB.JS)React离线(预)编译JSX
- Arm处理器与Linux的完美结合
- 通过egrep切割ifconfig后的IP地址
- response常用方法
- 从操作系统内核看Java非阻塞IO事件检测
- 数据库----(MySQL基本常见sql)
- 我读Batch Normalization
- EasyDarwin开源流媒体音视频云平台遇到的奇葩问题:内网运行正常,公网流媒体不通
- java获取分页对象时,出现的两种问题
- 二叉树:前序、中序、后序、层次遍历及实现
- [Leetcode] Merge Sorted Array
- JavaScript趣题:这是哪个世纪?
- 【Android】Face Recognition on Android(OpenCV)
- NOIP2016提高A组模拟9.17 总结