以下所有SQL语句全都是在window系统,oracle 11g 环境下测试
新建表
create table users(
user_id integer primary key,
user_name varchar2(20) not null
)
查询
- 当前用户下所有表表名
SELECT * FROM USER_TABLES;
- 当前数据库所有表所有字段
select t.column_name from user_col_comments t;
- 查询某表的所有字段
需要注意where 条件里边的表名需要全部大写,否则无法查询结果
select t.column_name from user_col_comments t
where t.table_name = 'USERS';