mysql中查询表自身属性的语句

mysql语句

此处查询了 表名、引擎、表注释、表创建时间

select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables
		where table_schema = (select database())
			and table_name like concat('%', 'pms_attr', '%') #删除这个and条件语句既:查询该库的所有表. 模糊查询条件--含有pms_attr表名的表
		order by create_time desc

IDEA中的语句:

	<select id="queryList" resultType="map">
		select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables
		where table_schema = (select database())
		<if test="tableName != null and tableName.trim() != ''">
			and table_name like concat('%', #{tableName}, '%')
		</if>
		order by create_time desc
	</select>
posted on 2021-10-28 11:03  汤姆猫8  阅读(142)  评论(0)    收藏  举报