重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

oracle怎么搜索表,查询表的索引 oracle

查找 oracle 数据库中包含某一字段的所有表的表名

1、首先,打开并登陆plsql。

公司专注于为企业提供成都网站设计、做网站、成都外贸网站建设公司、微信公众号开发、商城网站开发小程序制作,软件按需规划网站等一站式互联网企业服务。凭借多年丰富的经验,我们会仔细了解各客户的需求而做出多方面的分析、设计、整合,为客户设计出具风格及创意性的商业解决方案,创新互联更提供一系列网站制作和网站推广的服务。

2、然后点击左上角的新建,选择sqlwindow。

3、此时,右边区域就会弹出一个sql窗口,我们可以在这里输入一些sql语句。

4、查询多个字段的sql语句为:

select字段1,字段2from表名。

5、然后点击左上的执行sql语句图标。

6、耐心等待,在sql窗口下方就会展示你需要查阅的表中的对应字段了。

如何查询oracle数据库中所有的表

觉得你应该先弄清楚oracle的常规数据字典的结构,像9i里的常规数据字典中对象名称就有以USER,ALL,DBA为前缀的对象。

以USER为例,我们查该对象下有些什么表,就应该执行下列的语句:

SQLselect table_name from user_tables;

类似的,你可以进行替换。:)

如果你想查数据库中所有的表的话,可以查询

SELECT * FROM dba_tables

如果你想查询数据库中某个用户下的表的话,也可以登录这个用户,再查询:

SELECT * FROM USER_TABLES

要想导入外部sql语句可以用命令

sql @e:\文件名.sql

如你想保存 select * from tablename;语句的结果,可以在sql*plus 里面这样:

SPOOL c:\test.sql //这是保存文件的位置

select * from tablename;

SPOOL OFF

oracle怎么查询所有的表?有没有主键?

1、查找表的所有索引(包括索引名,类型,构成列):

select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查询的表

2、查找表的主键(包括名称,构成列):

select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' and au.table_name = 要查询的表

3、查找表的唯一性约束(包括名称,构成列):

select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'U' and au.table_name = 要查询的表

4、查找表的外键(包括名称,引用表的表名和对应的键名,下面是分成多步查询):

select * from user_constraints c where c.constraint_type = 'R' and c.table_name = 要查询的表

查询外键约束的列名:

select * from user_cons_columns cl where cl.constraint_name = 外键名称

查询引用表的键的列名:

select * from user_cons_columns cl where cl.constraint_name = 外键引用表的键名

5、查询表的所有列及其属性

select t.*,c.COMMENTS from user_tab_columns t,user_col_comments c where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = 要查询的表

6、Oracle中每个用户表的表名和行数

select table_name,num_rows from user_tables;

7、Oracle查询用户表空间:select * from user_all_tables

8、Oracle查询所有函数和储存过程:select * from user_source

9、Oracle查询所有用户:

select * from all_users;

select * from dba_users

10、Oracle查看当前用户连接:select * from v$Session

11、Oracle查看当前用户权限:select * from session_privs

12、Oracle查看用户表空间使用情况:

select a.file_id "FileNo",a.tablespace_name

"Tablespace_name",

a.bytes "Bytes",a.bytes-sum(nvl(b.bytes,0)) "Used",

sum(nvl(b.bytes,0)) "Free",

sum(nvl(b.bytes,0))/a.bytes*100 "%free"

from dba_data_files a, dba_free_space b

where a.file_id=b.file_id(+)

group by a.tablespace_name ,

a.file_id,a.bytes order by a.tablespace_name;

如何查看oracle数据库中的所有表

1、查询用户创建的所有表:

select * from user_tables;

2、 查询所有表,包括系统的:

select * from all_all_tables;

oracle里面怎么通过表名查找表数据

直接用超级管理员权限(sysdba)查看每个表空间中表名。 sql:Select Table_Name, Tablespace_Name From Dba_Tables Where Tablespace_Name = '表空间名字'; 解释:通过管理员权限登陆后,查看“Dba_Tables ”表中的字段信息即可完成查询表名操作...


网站标题:oracle怎么搜索表,查询表的索引 oracle
转载来源:http://cqcxhl.com/article/hecsgd.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP