소스 검색

更新 'README.md'

sckj 2 년 전
부모
커밋
9ce943bed3
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      README.md

+ 4 - 2
README.md

@@ -349,14 +349,15 @@ WHERE ISNULL(a.bbb)
 (14)比较文档里现有字段和实际数据库不一致的地方
 ```mysql
 SELECT * FROM
+
 (
 SELECT a1.TABLE_NAME, a1.COLUMN_NAME,a1.COLUMN_COMMENT,a1.IS_NULLABLE,a1.DATA_TYPE,a1.CHARACTER_MAXIMUM_LENGTH,a1.COLUMN_KEY, a2.zdmc,a2.zdlx,a2.zdgs,a2.sfbx,a2.dictid,a2.dbtype,a2.dblength,a2.ispk,a2.bbb,a2.zdbs, 
 
 case when a1.COLUMN_COMMENT = IF(a2.dictid = '' or a2.dictid is null,a2.zdmc,CONCAT(a2.zdmc,'(',a2.dictid,')')) then 'true' else 'false' end  as c1,
 case when a1.IS_NULLABLE = case when a2.sfbx = 'Y' then 'NO' else 'YES' end then 'true' else 'false' end  as c2,
 case when a1.DATA_TYPE = a2.dbtype then 'true' else 'false' end  as c3,
-case when a1.CHARACTER_MAXIMUM_LENGTH = a2.dblength or a2.dbtype= 'int' or a2.dbtype = 'decimal' then 'true' else 'false' end  as c4,
-case when a1.COLUMN_KEY = case when a2.ispk = '1' then 'PRI' else '' end then 'true' else 'false' end  as c5
+case when a1.CHARACTER_MAXIMUM_LENGTH = a2.dblength or a2.dbtype= 'int' or a2.dbtype = 'decimal' or ISNULL(a1.CHARACTER_MAXIMUM_LENGTH) then 'true' else 'false' end  as c4,
+case when ((a1.COLUMN_KEY = (case when a2.ispk = '1' then 'PRI' else '' end) ) or (a1.COLUMN_KEY = (case when a2.ispk = '1' then 'PRI' else 'MUL' end) )) then 'true' else 'false' end  as c5
 FROM 
 (SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'mz-cloud' and TABLE_NAME NOT like '%act%' and TABLE_NAME NOT like '%www%' and TABLE_NAME NOT like '%v_%' and TABLE_NAME NOT like '%qrtz%' and COLUMN_NAME not IN('create_time_str','create_user_id','create_user_type','create_by','create_unit','create_unit_name','update_time_str','update_user_id','update_by','update_unit','update_unit_name','state')) a1
 LEFT JOIN
@@ -364,6 +365,7 @@ LEFT JOIN
 ON a2.bbb = a1.TABLE_NAME  and a2.zdbs = a1.COLUMN_NAME
 
 ) a
+
 WHERE a.bbb is not null and (c1 != 'true' or c2 !='true' or c3 != 'true' or c4 != 'true' or c5 != 'true') 
 ```