=========== PostgreSQL ==============
database name
SELECT datname FROM pg_database
Get all the user-defined table names
select tablename from pg_tables where schemaname = public
列名
select COLUMN_NAME from information_schema.columns where table_name = 'users'
===========================
View all Oracle tables and fields
https://www.cnblogs.com/kongxc/p/9395148.html
get table field:
select *
from user_tab_columns
where Table_Name='用户表'
order by column_name
Acquire table Notes:
select *
from user_tab_comments
where Table_Name='用户表'
order by Table_Name
Gets the field Note:
select *
from user_col_comments
where Table_Name='用户表'
order by column_name
/ * Get the table: * /
select table_name from user_tables; // current user table
select table_name from all_tables; // all users table
select table_name from dba_tables; // table system comprising
select table_name from dba_tables where owner='zfxfzb'
/*
user_tables:
table_name,tablespace_name,last_analyzed等
dba_tables:
ower,table_name,tablespace_name,last_analyzed等
all_tables:
ower,table_name,tablespace_name,last_analyzed等
all_objects:
ower,object_name,subobject_name,object_id,created,last_ddl_time,timestamp,status等
*/
/ * Get the Field: * /
select * from user_tab_columns where Table_Name='用户表';
select * from all_tab_columns where Table_Name='用户表';
select * from dba_tab_columns where Table_Name='用户表';
/* user_tab_columns:
table_name,column_name,data_type,data_length,data_precision,data_scale,nullable,column_id等
all_tab_columns :
ower,table_name,column_name,data_type,data_length,data_precision,data_scale,nullable,column_id等
dba_tab_columns:
ower,table_name,column_name,data_type,data_length,data_precision,data_scale,nullable,column_id等
*/
/ * Get Table Notes: * /
select * from user_tab_comments
/*
user_tab_comments:table_name,table_type,comments
There are corresponding dba_tab_comments, all_tab_comments, two more columns ower than user_tab_comments.
* /
/ * Get Field Notes: * /
select * from user_col_comments
/*
user_col_comments:table_name,column_name,comments
There are corresponding dba_col_comments, all_col_comments, two more columns ower than user_col_comments.
* /
------------- ---------- oracle query all the tables
SELECT TABLE_NAME FROM all_tables
WHERE OWNER = 'PORTAL_HIS'
--and GLOBAL_STATS='NO'
ORDER BY table_name
----------oracle查询表字段-------------
SELECT COLUMN_NAME,DATA_TYPE FROM user_tab_columns where table_name = upper('BA_BAJY')
select * from all_users
---------- sql queries all tables -------------
the Select the From the sysobjects WHERE xtype name = 'the U-'
---------- sql lookup table field -------------
the Select the Where the syscolumns ID = name from the OBJECT_ID ( 'TB')
---------- SQL query and category field ------- ------
SELECT column_name, data_type from information_schema.columns from
WHERE table_name = 'TB'
---------- sql create a temporary table -------------
IF OBJECT_ID ( 'dbo. # TableList', 'U') IS the NOT NULL
DROP TABLE dbo. # TableList ;
CREATE TABLE #tablelist
(
id int identity(1,1) primary key,
fieldnm varchar(200),
fieldty varchar(50),
fieldvalue varchar(200)
)
select * from #tablelist
================================================
- owner in the query library --- ---
Exec sp_helpuser
-----查询表---
Select "name",uid,xtype,category From sysobjects a
where xtype='u' or xtype='v' and category=0