更改字段类型
alter table email modify date datetime ;(date字段的类型改为datetime)
更改字段长度
alter table email modify column uid varchar(2048);(uid字段)
增加字段
alter table email add languages varchar(128);
alter table server add deadline datetime;
修改字段名
ALTER TABLE email CHANGE languages languages VARCHAR(128) AFTER status;
mysql向表中某字段后追加一段字符串: update user set auth=CONCAT(auth,',100') where id='2';
UPDATE user SET auth=CONCAT(auth,'',',100') WHERE username= 'aaa';
mysql 向表中某字段前加字符串 update table_name set field=CONCAT('str',field);
id一样,合并指定字段
SELECT id,title,attachment,date,GROUP_CONCAT( uid SEPARATOR "," ) uid FROM email where id='12';
查询表结构
desc user;
show create table user;
清除表数据
delete from stat_copy_test;
truncate table user;
查数据库编码
show variables like 'character%';
查询数据库中的存储过程
show procedure status;
查看存储过程创建代码
show create procedure proc_name;
查看数据库event是否开启
show variables like '%sche%';
将事件计划开启
set global event_scheduler=1;
查看表分区
SELECT partition_name part, partition_expression expr, partition_descriptiondescr, table_rows FROM INFORMATION_SCHEMA.partitions WHERE TABLE_SCHEMA = schema() AND TABLE_NAME='data_sdk';
