数据库学习笔记 --- SQL查询数据库中所有表中的字段名和字段类型

来源:互联网 发布:windows hook框架 编辑:程序博客网 时间:2024/04/29 16:45

这里总结几个数据库的查询所有表字段名和字段类型的SQL语句:

Mysql database:

 

select COLUMN_NAME, DATA_TYPE from information_schema.COLUMNS where table_name = 


Oracle database:

select column_name, data_type from all_tab_columns  where  TABLE_NAME = 


SQLServer database

select column_name,data_type from information_schema.columns where table_name = 


Postgresql database

select column_name, data_type from information_schema.columns where table_name = 'ahnavi' ORDER BY ordinal_position;




0 0