The query below helps you to locate tables without a primary key:
SELECT tables.table_schema, tables.table_name, tables.table_rows
FROM information_schema.tables
LEFT JOIN (
SELECT table_schema, table_name
FROM information_schema.statistics
GROUP BY table_schema, table_name, index_name
HAVING
SUM(
CASE WHEN non_unique = 0 AND nullable != 'YES' THEN 1 ELSE 0 END
) = COUNT(*)
) puks
ON tables.table_schema = puks.table_schema AND tables.table_name = puks.table_name
WHERE puks.table_name IS NULL
AND tables.table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
AND tables.table_type = 'BASE TABLE' AND engine='InnoDB';
mysql> SET GLOBAL slave_rows_search_algorithms = 'INDEX_SCAN,HASH_SCAN';
The query below helps you to locate tables without a primary key:的更多相关文章
- symfony2已有数据表导入实体时报错 Doctrine does not support reverse engineering from tables that don't have a primary key
先在配置文件 app/config/config.yml中配置 schema_filter: /^(?!(tablename))/ 即可,或者在出现问题表都加上一个id 然后再使用命令 php app ...
- InnoDB On-Disk Structures(一)-- Tables (转载)
转载.节选于https://dev.mysql.com/doc/refman/8.0/en/innodb-tables.html 1.InnoDB Architecture The following ...
- MYSQL PERFORMANCE_SCHEMA HINTS
ACCOUNTS NOT PROPERLY CLOSING CONNECTIONS [ 1 ] Works since 5.6 SELECT ess.user, ess.host , (a.total ...
- 13.1.17 CREATE TABLE Syntax
13.1.17 CREATE TABLE Syntax 13.1.17.1 CREATE TABLE ... LIKE Syntax 13.1.17.2 CREATE TABLE ... SELECT ...
- MySQL 5.6 Reference Manual-14.6 InnoDB Table Management
14.6 InnoDB Table Management 14.6.1 Creating InnoDB Tables 14.6.2 Moving or Copying InnoDB Tables to ...
- MySQL/MariaDB数据库的服务器配置
MySQL/MariaDB数据库的服务器配置 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.MySQL中的系统数据库 1>.mysql数据库 是mysql的核心数据库,类 ...
- ocp 1Z0-047 131-276题解析
131. Which view would you use to display the column names and DEFAULT valuesfor a table?A. DBA_TABLE ...
- ocp 1Z0-047 1-60题解析
1. You need to load information about new customers from the NEW_CUST table into the tables CUST and ...
- SQL基础笔记
Codecademy中Learn SQL, SQL: Table Transformaton和SQL: Analyzing Business Metrics三门课程的笔记,以及补充的附加笔记. Cod ...
随机推荐
- js中defer实现等文档加载完在执行脚本
我们可以使用defer来实现类似window.onload的功能: <script src="../CGI-bin/delscript.js" defer></s ...
- python学习(三)
- Matlab:导数边界值的有限元(Galerkin)法
tic; % this method is transform from Galerkin method %also call it as finit method %is used for solv ...
- Python- - -函数目录
一.函数的定义.调用.返回值.参数. 二.名称空间.作用域.加载顺序.取值顺序. 三.函数的嵌套.作用域链.函数名的应用.闭包. 四.装饰器
- 使用mint-ui中弹框组件与原生弹框阻止父页面不滑动方法
1,使用mint-ui框架中<mt-popup></mt-popup>,在组件中加入 lockScroll="true" 阻止父页面不滑动. 2,原生弹框中 ...
- Delegate, NSNotification, KVO, Block
delegate: 当我们第一次编写iOS应用时,我们注意到不断的在使用“delegate”,并且贯穿于整个SDK.delegation模式不是iOS特有的模式,而是依赖与你过去拥有的编程背景.针对它 ...
- 在Postman中使用不受信任的SSL证书(转)
add by zhj: 在http://www.cnblogs.com/ajianbeyourself/p/3898911.html中提到: 对于不受信任的证书,浏览器会发出告警,不过这些也只是告警而 ...
- 关于WebUpload插件的使用
上传的路径地址: 删除图片时也应该注意: unlink('/Upload/1.jpg')删除不了 unlink('./Upload/1.jpg')可以删除. 也就是说,绝对路径删除不了 相对路径可以 ...
- HTML5⑥
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- python if __name__=='__main__'的理解
定义一个模块叫module.py: def main(): print "we are in %s" %__name__ if __name__=='__main__': main ...