生成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;
然后再复制执行即可
1.定长和变长的分离 如int,char,time所占字节是固定的字段放在一张表 如varchar,text所占字节不确定的字段放在一张表中2.常用字段和不常用字段进行分离,根据查询频率来设计3.一对多的关联表可以添加冗余字段,如商品分类表 和商品表 ,在首页中需要显示每个分类商...
需求查询出存在商品的商品分类. 先看看分类表:id(分类的id) catename(分类名) 1 手机 2 &n...
1.floor(x)返回小于x的整数,向下取整,用法,商品的价格是浮点型的,需要向下取整 eg:select id,title,floor(price) from shopgoods2.rand()返回0-1之间的随机数 select rand() select rand()...
(1).首先我们需要了解limit分页的工作流程demo: SELECT * FROM table LIMIT 10000,5 通常我们会认为以上SQL会从10000条后面取5条,正确的是取出10005条,然后再抛弃前...
1.很多人认为count查询非常快,但是在加上筛选条件那就是未必的了!测试:user表中4000w数据(1).SELECT count(*) from user; 用时0.00s (2).SELECT...
已有表名log来记录用户日志,id是主键,uid是用户id,rmk是备注,addtime是时间戳,需要取出不重复的用户日志记录默认的结果集:id uid rmk ...