mysql查询表名和列名字

-- 登录yellowcong 数据库

mysql -uroot -proot yellowcong

   

-- 查看当前数据库

select database()

   

-- 查看数据库里面的表

--table_schema 当前的数据库

--table_type='base table' 表示基础的普通表

SELECT table_name FROM information_schema.tables WHERE table_schema='yellowcong' AND table_type='base table';

   

   

-- 查询指定数据库中指定表的所有字段名column_name

-- 查看列的名称

SELECT column_name FROM information_schema.columns WHERE table_schema='yellowcong' AND table_name='sys_user';

原文地址:https://www.cnblogs.com/withfeel/p/11640817.html