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 ...
随机推荐
- linux软件管理之rpm管理rpm包
使用RPM工具管理RPM包 ====================================================================================需要 ...
- windows 和linux 文件互传
1.sz + 文件 [拷贝到windows上] 2.rz + 文件 [拷贝到linux上]
- python自动化测试入门篇-jemter参数化
一.Jmeter参数化 1.使用用户自定义变量 用户定义的变量,引用方式:${定义参数名称};例如定义一个变量IP,使用它的时候用 ${IP}. 添加一个 User Defined Variables ...
- icpc2018-焦作-D-几何模拟
https://nanti.jisuanke.com/t/34142 上午可能是供氧不足,推的式子死活不对,晚上莫名其妙又来了一次就过了. 分两种情况讨论,如果能够完全进入弯道答案就是固定的就是: s ...
- Oracle 11g streams部署
环境 源服务器 目标服务器 系统版本 CentOS Linux release 7.3.1611 (Core) CentOS Linux release 7.3.1611 (Core) 主机名 s ...
- OSSIM安装使用教程(OSSIM-5.6.5)
一.说明 1.1 相关概念说明 SEM,security event management,安全事件管理,指对事件进行实时监控,收集信息差展生通知和告警的行为. SIM,security inform ...
- S2T40,第四章,简答4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- leetcode python 030 Substring with Concatenation of All Words
## 您将获得一个字符串s,以及一个长度相同单词的列表.## 找到s中substring(s)的所有起始索引,它们只包含所有单词,## eg:s: "barfoothefoobarman&q ...
- UVALive - 4223,hdu2962(简单dijkstra)
Trucking Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- Bitmap RGB24 4字节对齐
Bitmap RGB24 4字节对齐 本文中说的图片都是无压缩的彩色Bitmap图片. 最近在一个项目中有一个场景是需要将RGB32或RGB24的Bitmap转换成为RGB565的Bitmap,在RG ...