![MySQL - 查询数据库里所有表名和字段名](https://600zi.400zi.cn/uploadfile/img/15/298/f8232bfb5d3c48f4ab63cc60914adacf.jpg)
查询数据库里所有表名和字段名的语句
SQL 查询所有表名
SELECT NAME FROM SYSOBJECTS WHERE TYPE='U'SELECT * FROM INFORMATION_SCHEMA.TABLES
查询表的所有字段名
SELECT NAME FROM SYSCOLUMNS WHERE ID=OBJECT_ID(' 表名' )SELECT * FROM INFORMATION_SCHEMA.TABLESSELECT * FROM INFORMATION_SCHEMA.VIEWSSELECT * FROM INFORMATION_SCHEMA.COLUMNS
查询该库所有表名对应的字段名
SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '库名'
ORACLE 查看所有表名
SELECT TABLE_NAME FROM USER_TABLES
ACCESS 查看所有表名
SELECT NAME FROM MSYSOBJECTS WHERE TYPE=1 AND FLAGS=0MSYSOBJECTS 是系统对象,默认情况是隐藏的。通过工具、选项、视图、显示、系统对象可以使之显示出来