生成sql格式(将qdm723412313_db改为你的数据库名称即可):
SELECT concat( 'alter table ', table_name, ' engine=InnoDB CHARSET=utf8mb4; ' ) FROM information_schema.TABLES t WHERE table_schema = 'qdm723412313_db' AND table_type = 'base table';
生成数据如下:
alter table cmf_user engine=InnoDB CHARSET=utf8mb4; alter table think_ad engine=InnoDB CHARSET=utf8mb4; alter table think_ad_type engine=InnoDB CHARSET=utf8mb4; alter table think_admin engine=InnoDB CHARSET=utf8mb4; alter table think_admin_log engine=InnoDB CHARSET=utf8mb4; alter table think_answer_question engine=InnoDB CHARSET=utf8mb4; alter table think_article engine=InnoDB CHARSET=utf8mb4; alter table think_auth_group engine=InnoDB CHARSET=utf8mb4;
然后再复制执行即可
下面的是商品数据表,id是主键,catename是分类,titile是标题,price是价格,现在要求计算每种分类下的商品平均价格.id catename &n...
where与having非常类似.都能筛选数据.表达式完全一致. 但是职责的确不同.where负责对表中的字段进行筛选,having负责对where筛选后的结果集再次筛选。这也就是where不能使用别名字段来筛选的原因,因为数据中没有这个字段。&n...
一般情况下,绝大部分,我们的主键是数字,1 2 3 4...所以我们才让它递增.这并不意味着,他们两个必须要绑定在一起使用.例如我还想将用户表的email字段设置为主键,但是并没有必要为其设置自增。 因此可...
1.很多人认为count查询非常快,但是在加上筛选条件那就是未必的了!测试:user表中4000w数据(1).SELECT count(*) from user; 用时0.00s (2).SELECT...
1.查看歌曲表结构(主要是给name字段添加全文索引)(mysql5.7才支持全中文索引)desc music; +---------+-------------+------+-----+---------+----------------+ | Fie...
已有表名log来记录用户日志,id是主键,uid是用户id,rmk是备注,addtime是时间戳,需要取出不重复的用户日志记录默认的结果集:id uid rmk ...