1. 程式人生 > >SQL基礎操作_3_資料字典

SQL基礎操作_3_資料字典

7.5.1 列出模式中所有的表

需求:查詢給定模式下建立的所有表和建立時間。

解決方法:通過各個資料庫裡提供的系統檢視查詢。

Sql Server:

USE Shenl;
GO
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.tables
WHERE TABLE_TYPE='BASE TABLE'

或:

SELECT NAME as table_name FROM SYSOBJECTS WHERE XTYPE='U' ORDER BY NAME

或:

SELECT name as table_name,create_date as create_time FROM [sys].[all_objects]
WHERE type='U' AND is_ms_shipped=0
ORDER BY NAME

執行結果:

Database_Name

Create_time

master

2003-04-08 09:13:36.390

tempdb

2017-04-16 09:36:02.723

model

2003-04-08 09:13:36.390

msdb

2014-02-20 20:49:38.857

ReportServer

2017-03-19 09:58:21.533

ReportServerTempDB

2017-03-19 09:58:22.640

AdventureWorks2014

2017-03-19 15:34:10.683

AdventureWorksDW2014

2017-03-19 15:39:02.770

Shenl

2017-04-11 12:57:23.723

Mysql:

use shenl;
SELECT TABLE_NAME,CREATE_TIME,TABLE_COMMENT FROM INFORMATION_SCHEMA.tables
WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='shenl'
ORDER BY TABLE_COMMENT DESC

執行結果:

TABLE_NAME

CREATE_TIME

TABLE_COMMENT

emp

2017/4/16 9:14:40

僱員表

dept

2017/4/16 9:14:39

部門表

salgrade

2017/4/16 9:14:41

工資等級表

bonus

2017/4/16 9:14:41

獎金錶

Oracle:

SELECT TABLE_NAME FROM USER_TABLES;
SELECT TABLE_NAME FROM ALL_TABLES
WHERE OWNER='SHENL;

SELECT OBJECT_NAME ,CREATED
FROM ALL_OBJECTS
WHERE OBJECT_TYPE='TABLE'  
AND OWNER='SHENL'
ORDER BY CREATED DESC

執行結果:

table_name

create_time

TMP_V

2017/3/31 18:49:06

SALGRADE

2017/3/27 15:25:47

BONUS

2017/3/27 15:25:47

DEPT

2017/3/27 15:25:46

EMP

2017/3/27 15:25:44

7.5.2 列出所有的資料庫

需求:查詢給當前資料庫例項下所有的資料庫名和建立時間。

解決方法:通過各個資料庫裡提供的與資料庫相關的資料字典進行查詢。

SqlServer:

SELECT NAME AS Database_Name,create_date AS Create_time
FROM sys.databases

執行結果:

Database_Name

Create_time

master

2003-04-08 09:13:36.390

tempdb

2017-04-16 09:36:02.723

model

2003-04-08 09:13:36.390

msdb

2014-02-20 20:49:38.857

ReportServer

2017-03-19 09:58:21.533

ReportServerTempDB

2017-03-19 09:58:22.640

AdventureWorks2014

2017-03-19 15:34:10.683

AdventureWorksDW2014

2017-03-19 15:39:02.770

Shenl

2017-04-11 12:57:23.723

Oracle:

Oracle裡的資料庫概念跟Sql Server略有不同,oracle裡一個數據庫對應多個例項,當然在Sql Server裡也可以安裝多個例項。不過一般不這麼做。Oralce裡的使用者類似於Sql Server裡的資料庫,即一個使用者下可能會有很多表。所以當前命題可以查詢當前例項裡的使用者名稱。

注: 這裡關於oracle的資料庫、資料庫例項、表空間、表、使用者沒有做過多的展開。簡單的說一個數據庫可以對應多個數據庫例項,而一個數據庫例項對應多個表空間,每個表空間對應多個使用者和資料庫檔案。一個使用者可以建立多個表。見下圖示意:

select name from v$database;
select USERNAME,Created AS Create_time from dba_users;

執行結果:

USERNAME

Create_time

Sys

2003-04-08 09:13:36.390

Scott

2003-04-16 09:36:02.723

Shenl

2003-04-08 09:13:36.390

注:

1 oralce資料庫、例項、表空間、使用者、表分析參考來源 http://blog.csdn.net/haiross/article/details/20357675

2 使用者資料較多,這裡用…省略。

Mysql:

show databases
-- 或
SELECT SCHEMA_NAME FROM information_schema.SCHEMATA

執行結果:        

SCHEMA_NAME

information_schema

mysql

performance_schema

shenl

7.5.3 列出給定表的基本資訊

需求:查詢出給定的表dept,emp,bonus,salgrade裡的表名,欄位名、欄位型別、欄位註釋、表註釋資訊。

解決方法:通過各個資料庫裡提供的與資料庫相關的資料字典進行查詢。

Oracle:

SELECT B.TABLE_NAME,B.COLUMN_NAME,B.DATA_TYPE,A.COMMENTSAS Table_Comm ,C.COMMENTSASColumn_Comm
from user_tab_comments A
JOIN user_tab_columns B
ON A.TABLE_NAME = B.TABLE_NAME
JOIN user_col_comments C
ON B.TABLE_NAME = C.TABLE_NAMEANDB.COLUMN_NAME = C.COLUMN_NAME
WHERE A.TABLE_NAME IN('DEPT','EMP','BONUS','SALGRADE')

Mysql:

SELECT A.TABLE_NAME,A.COLUMN_NAME,A.DATA_TYPE,B.TABLE_COMMENTAS Table_Comm,A.COLUMN_COMMENT AS Column_Comm
FROM INFORMATION_SCHEMA.COLUMNS A
JOIN INFORMATION_SCHEMA.TABLES B
ON A.TABLE_NAME = B.TABLE_NAME
WHERE A.TABLE_SCHEMA='SHENL'
AND A.TABLE_NAME IN('DEPT','EMP','BONUS','SALGRADE')

SqlServer:

USE Shenl;
GO
SELECT
     A.name AS table_name,
     B.name AS column_name,
     C.name AS data_type,
     D.value AS column_comm
FROM sys.tables A
INNER JOIN
(
SELECT B.object_id,NULL AS name,NULL AS user_type_id,0 as column_id FROMsys.tables A
INNER JOIN sys.columns B
     ON B.object_id= A.object_id
     WHERE A.name IN ('dept','emp','bonus','salgrade') AND column_id = 1
UNION
SELECT object_id,name,user_type_id,column_id FROM sys.columns
)B
     ON B.object_id= A.object_id
LEFT JOIN sys.systypes C
ON B.user_type_id= C.xtype
INNER JOIN sys.extended_properties D
     ON D.major_id= B.object_id AND
        D.minor_id = B.column_id
WHERE A.name IN ('dept','emp','bonus','salgrade')
ORDER BY A.name

-- 或:

USE Shenl;
GO
SELECT table_name,column_name,data_type,column_comm,F.value as table_comm FROM
(
SELECT A.object_id AS Object_id,
     A.name AS table_name,
     B.name AS column_name,
     C.name AS data_type,
     D.value AS column_comm
FROM sys.tables A
INNER JOIN sys.columns B
     ON B.object_id= A.object_id
LEFT JOIN sys.systypes C
ON B.user_type_id= C.xtype
INNER JOIN sys.extended_properties D
     ON D.major_id= B.object_id AND
        D.minor_id = B.column_id
WHERE A.name IN ('dept','emp','bonus','salgrade')
)E
JOIN
(
SELECT major_id,value FROM sys.extended_propertiesA
JOIN sys.tables B
ON A.major_id= B.object_id
AND B.name IN  ('dept','emp','bonus','salgrade') AND A.minor_id = 0
)F
ON E.object_id= F.major_id

執行結果:

table_name

column_name

data_type

column_comm

table_comm

dept

deptno

int

部門編號

部門表

dept

dname

varchar

部門名稱

部門表

dept

loc

varchar

部門所在位置

部門表

emp

empno

int

僱員編號

僱員表

emp

ename

varchar

僱員名稱

僱員表

emp

job

varchar

僱員職位

僱員表

emp

mgr

int

僱員對應的領導的編號

僱員表

emp

hiredate

date

僱員的僱傭日期

僱員表

emp

sal

decimal

僱員的基本工資

僱員表

emp

comm

decimal

獎金

僱員表

emp

deptno

int

所在部門

僱員表

salgrade

grade

int

工資等級

工資等級表

salgrade

losal

int

此等級的最低工資

工資等級表

salgrade

hisal

int

此等級的最高工資

工資等級表

bonus

ename

varchar

僱員姓名

獎金錶

bonus

job

varchar

僱員職位

獎金錶

bonus

sal

decimal

僱員工資

獎金錶

bonus

comm

decimal

僱員資金

獎金錶

注:

1 sql server裡的第一種實現方式是將表的註釋作為一行,其它欄位如(column_name、data_type)均以NULL值顯示。

2 如果不瞭解各個資料庫的註釋方式,如下做個簡單示例:

Oracle:

comment on table EMP is '僱員表';
comment on column EMP.EMPNO is '僱員的編號,由四位數字所組成';

Sql Server:

sql server裡的註釋儲存在系統表sys.extended_properties中,一般我們通過呼叫儲存過程sp_addextendedproperty來對錶和欄位加註釋。

EXECUTE sp_addextendedproperty N'MS_Description',N'獎金錶',N'user',N'dbo',N'table',N'bonus',NULL,NULL
EXECUTE sp_addextendedproperty N'MS_Description',N'僱員姓名',N'user',N'dbo',N'table',N'bonus',N'column',N'ename'

Mysql:

ALTER TABLE `EMP` COMMENT '僱員表';
ALTER TABLE `EMP` MODIFY COLUMN `empno`  COMMENT  '僱員編號';

7.5.4 列出給定表的索引資訊

需求:查詢出給定的表emp的索引資訊。

解決方法:通過各個資料庫裡提供的與索引相關的資料字典進行查詢。

Oracle:

CREATE INDEX Idx_EMP_EMPNO ON EMP(EMPNO);
 
SELECT table_name,index_name,column_name,column_position
FROM sys.all_ind_columns
WHERE table_name ='EMP'
      ANDtable_owner='SHENL';

執行結果:

TABLE_NAME

INDEX_NAME

COLUMN_NAME

COLUMN_POSITION

EMP

IDX_EMP_EMPNO

EMPNO

1

Sql Server:

SELECT a.name AS table_name,
b.name AS index_name,
d.name AS column_name,
c.index_column_id
FROM sys.tables a,sys.indexes b,sys.index_columns c,sys.columns d
WHERE a.object_id= b.object_id
     AND b.object_id= c.object_id
     AND b.index_id= c.index_id
     AND c.object_id= d.object_id
     AND c.column_id= d.column_id
     AND a.name='EMP'

執行結果:

table_name

index_name

column_name

index_column_id

emp

PK__emp__AF4C318A634F478A

empno

1

Mysql:

show indexfrom emp;

7.5.5 列出給定表的主鍵、外來鍵約束

需求:查詢出給定的表emp的外來鍵約束資訊。

解決方法:通過各個資料庫裡提供的與外來鍵約束相關的資料字典進行查詢。

SqlServer:

SELECT a.table_name,
a.CONSTRAINT_NAME,
b.COLUMN_NAME,
a.CONSTRAINT_TYPE
FROM information_schema.table_constraints a,
information_schema.key_column_usage b
WHERE a.table_name='EMP'
-- AND a.table_schema='SHENL'
AND a.table_name= b.table_name
AND a.table_schema= b.table_schema
AND a.constraint_name= b.constraint_name

執行結果:

table_name

CONSTRAINT_NAME

COLUMN_NAME

CONSTRAINT_TYPE

emp

FK__emp__deptno__38996AB5

deptno

FOREIGN KEY

emp

PK__emp__AF4C318A634F478A

empno

PRIMARY KEY

如果只是查主鍵資訊可以:

SELECT
  tab.name AS table_name,
  idx.name AS pk_name,
  col.name AS column_name
FROM
  sys.indexes idx
    JOIN sys.index_columns idxCol
      ON idx.object_id= idxCol.object_id
          AND idx.index_id=idxCol.index_id
          AND idx.is_primary_key= 1
    JOIN sys.tables tab
      ON idx.object_id= tab.object_id
    JOIN sys.columns col
      ON idx.object_id= col.object_id
          AND idxCol.column_id=col.column_id
            AND tab.name='EMP'    

執行結果:

table_name

pk_name

column_name

emp

PK__emp__AF4C318A634F478A

empno

注:

1 如果想查唯一約束可以將上述高亮處修改為:

ANDidx.is_unique_constraint = 1。

2 預設情況下會在基於主鍵建立個索引。

3 這裡說的主外來鍵約束對應constraint,一般包括PK、FK、UK即主鍵、外來鍵、唯一鍵。而約束一般指的是default、check即預設值約束、檢查約束。

Mysql:

SELECT CONSTRAINT_NAME,TABLE_NAME,COLUMN_NAME,
 REFERENCED_TABLE_NAME,
 REFERENCED_COLUMN_NAME
 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
 WHERE TABLE_SCHEMA='SHENL'
AND TABLE_NAME IN('emp')

Oracle:

SELECT A.CONSTRAINT_NAME,A.TABLE_NAME,A.COLUMN_NAME,B.CONSTRAINT_TYPE
FROM USER_CONS_COLUMNS A,USER_CONSTRAINTS B
WHERE A.CONSTRAINT_NAME =B.CONSTRAINT_NAME
  AND B.CONSTRAINT_TYPEIN('P','R')
  AND A.TABLE_NAME ='EMP'

7.5.6 列出給定表的外來鍵引用

需求:查詢出給定的表emp的外來鍵約束資訊。

解決方法:通過各個資料庫裡提供的與外來鍵約束相關的資料字典進行查詢。

SqlServer:

SELECT
  RefObj.name AS RefTab_Name,
  fk.name AS Fk_Name,
  RefCol.name AS RefTab_Column_Name,
  RefedObj.name AS RefedTab_Name,
  RefedCol.nameAS RefedTab_Column_Name
FROM sys.foreign_keys fk 
JOIN sys.all_objectsRefObj 
     ON fk.parent_object_id= RefObj.object_id
JOIN sys.all_objects RefedObj
    ON fk.referenced_object_id=RefedObj.object_id
JOIN sys.foreign_key_columns fkCols
    ON fk.object_id= fkCols.constraint_object_id
JOIN sys.columns RefCol
    ON RefObj.object_id= RefCol.object_id 
     AND fkCols.parent_column_id=RefCol.column_id
JOIN sys.columns RefedCol
    ON RefedObj.object_id= RefedCol.object_id 
     AND fkCols.referenced_column_id=RefedCol.column_id;

執行結果:

RefTab_Name

Fk_Name

RefTab_Column_Name

RefedTab_Name

RefedTab_Column_Name

emp

FK__emp__deptno__38996AB5

deptno

dept

deptno

Mysql:

SELECT CONSTRAINT_NAME,TABLE_NAME,COLUMN_NAME,
 REFERENCED_TABLE_NAME,
 REFERENCED_COLUMN_NAME
 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
 WHERE TABLE_SCHEMA='SHENL' AND TABLE_NAME IN('emp') AND REFERENCED_TABLE_NAME IS NOT NULL

Oracle:

SELECT A.CONSTRAINT_NAME,A.TABLE_NAME,A.COLUMN_NAME,B.CONSTRAINT_TYPE
FROM USER_CONS_COLUMNS A,USER_CONSTRAINTS B
WHERE A.CONSTRAINT_NAME =B.CONSTRAINT_NAME
  AND B.CONSTRAINT_TYPEIN('R')
  AND A.TABLE_NAME ='EMP'

7.5.7 列出給定表的檢查約束

需求:查詢出給定的表emp的檢查約束(check)資訊。

解決方法:通過各個資料庫裡提供的與檢查約束(check)相關的資料字典進行查詢。

SqlServer:

-- 新增check約束以檢查emp表的enmae欄位長度不超過16
ALTER TABLE EMP DROP CONSTRAINT CK_Emp_Ename;
ALTER TABLE EMP ADD CONSTRAINT CK_Emp_Ename CHECK(LEN(ename)<16);
SELECT A.name AS CKConstraint_Name,
     B.name AS Table_Name,
     C.name AS CKConstraint_ColumnName,
     A.definition AS DF_Def,
     A.create_date AS Create_time,
     A.modify_date AS Modify_time
FROM sys.check_constraints A
JOIN sys.tables B
     ON A.parent_object_id= B.object_id
JOIN sys.columns C
     ON B.object_id= C.object_idAND A.parent_column_id= C.column_id

執行結果:

CKConstraint_Name

Table_Name

CKConstraint_ColumnName

DF_Def

Create_time

Modify_time

CK_Emp_Ename

emp

ename

(len([ename])<(16))

2017-04-19 10:17:41.640

2017-04-19 10:17:41.640

Mysql:

ALTER TABLE EMP ADD CONSTRAINT CK_Emp_Ename CHECK (LEN(ename)<16);

;Mysql資料字典裡沒有存check約束,所以暫時無法查閱。

Oracle:

ALTER TABLE EMP ADD CONSTRAINT CK_Emp_Ename CHECK (LENGTH(ename)<15);
 
SELECT A.CONSTRAINT_NAME,A.TABLE_NAME,A.COLUMN_NAME,B.CONSTRAINT_TYPE
FROM USER_CONS_COLUMNS A,USER_CONSTRAINTS B
WHERE A.CONSTRAINT_NAME =B.CONSTRAINT_NAME
  AND B.CONSTRAINT_TYPEIN('C')
  AND A.TABLE_NAME ='EMP'

7.5.8 列出給定表的預設約束

需求:查詢出給定的表emp的預設約束(default)資訊。

解決方法:通過各個資料庫裡提供的與預設約束(default)相關的資料字典進行查詢。

SqlServer:

-- 新增default約束以設定emp表的comm預設值是0
alter table EMP drop constraint DF_EMP_Comm;
alter table EMP add constraint DF_EMP_Comm DEFAULT((0)) for comm;
alter table EMP with check add constraint DF_EMP_Comm DEFAULT((0)) for comm;
alter table EMP with nocheck add constraint DF_EMP_Comm DEFAULT((0)) for comm;
 
SELECT A.name AS DFConstraint_Name,
     B.name AS Table_Name,
     C.name AS DFConstraint_ColumnName,
     A.definition AS DF_Def,
     A.create_date AS Create_time,
     A.modify_date AS Modify_time
FROM sys.default_constraints A
JOIN sys.tables B
     ON A.parent_object_id= B.object_id
JOIN sys.columns C
     ON B.object_id= C.object_id AND A.parent_column_id= C.column_id;

執行結果:

DFConstraint_Name

Table_Name

DFConstraint_ColumnName

DF_Def

Create_time

Modify_time

DF_EMP_Comm

emp

comm

((0))

2017-04-19 09:24:14.050

2017-04-19 09:24:14.050

Mysql:

SELECT TABLE_NAME,COLUMN_NAME,COLUMN_DEFAULT
FROM information_schema.columns 
WHERE TABLE_NAME = 'EMP' 
AND column_default IS NOT NULL

Oracle:

alter table EMP modify comm default 0;
SELECT t.COLUMN_NAME,
  t.nullable,
 t.data_default
FROM USER_TAB_COLS t
WHERE TABLE_NAME ='EMP'
      AND data_default IS NOT NULL

7.5.9 列出給定表的所有約束

需求:查詢出給定的表emp的相關的約束資訊。

解決方法:通過各個資料庫裡提供的與約束相關的資料字典進行查詢。

SqlServer:

SELECT B.name AS Constraint_Name,
 B.type,
 CASE B.type WHEN 'PK' THEN '主鍵'
     WHEN 'F'THEN '外來鍵'
     WHEN 'D'THEN '預設值約束'
     WHEN 'C'THEN '檢查約束' END AS ConstaintType_Desc,
 CASE B.type WHEN 'PK' THEN G.COLUMN_NAME
     WHEN 'F' THEN  G.COLUMN_NAME
     WHEN 'D' THEN E.name
     WHEN 'C' THEN F.name END AS Column_name,
 CASE B.type WHEN 'PK' THEN NULL
     WHEN 'F' THEN NULL
     WHEN 'D' THEN C.definition
     WHEN 'C' THEN D.definition END AS Define,
     B.create_date AS Create_Time,
     B.modify_date AS Modify_Time
 FROM  sys.all_objects A
 JOIN sys.all_objects B
     ON A.object_id= B.parent_object_id
 JOIN sys.default_constraints C
     ON B.parent_object_id= B.parent_object_id
 JOIN sys.check_constraints D
     ON B.parent_object_id= D.parent_object_id
 JOIN sys.all_columns E
     ON E.object_id= C.parent_object_id
          AND C.parent_column_id= E.column_id
 JOIN sys.all_columns F
     ON F.object_id= D.parent_object_id
          AND D.parent_column_id= F.column_id
LEFT JOIN information_schema.key_column_usage G
     ON B.name= G.CONSTRAINT_NAME
WHERE A.NAME='EMP'

執行結果:

Constraint_Name

type

ConstaintType_Desc

Column_name

Define

Create_Time

Modify_Time

PK__emp__AF4C318A634F478A

PK

主鍵

empno

NULL

2017-03-27 16:27:00.583

2017-03-27 16:27:00.583

FK__emp__deptno__38996AB5

F

外來鍵

deptno

NULL

2017-03-27 16:27:00.583

2017-03-27 16:27:00.583

DF_EMP_Comm

D

預設值約束

comm

((0))

2017-04-19 09:24:14.050

2017-04-19 09:24:14.050

CK_Emp_Ename

C

檢查約束

ename

(len([ename])<(16))

2017-04-19 10:17:41.640

2017-04-19 10:17:41.640

注:

sys.all_objects裡的type的列舉型別有如下:

執行結果:

type

資料庫物件型別

AF

聚合函式(CLR)

C

CHECK約束

D

DEFAULT(約束或獨立)

F

FOREIGNKEY約束

PK

PRIMARYKEY約束

P

SQL儲存過程

PC

程式集(CLR)儲存過程

FN

SQL標量函式

FS

程式集(CLR)標量函式

FT

程式集(CLR)表值函式

R

規則(舊式,獨立)

RF

複製篩選過程

SN

同義詞

SQ

服務佇列

TA

程式集(CLR)DML觸發器

TR

SQLDML觸發器

IF

SQL內聯表值函式

TF

SQL表值函式

U

表(使用者定義型別)

UQ

UNIQUE約束

V

檢視

X

擴充套件儲存過程

IT

內部表

注:資料庫物件型別這列為自己新增的備註。

Mysql:注意mysql內並無同一檢視可以滿足上述需求。

Oracle:

SELECT A.CONSTRAINT_NAME,A.TABLE_NAME,A.COLUMN_NAME,B.CONSTRAINT_TYPE
FROM USER_CONS_COLUMNS A,USER_CONSTRAINTS B
WHERE A.CONSTRAINT_NAME =B.CONSTRAINT_NAME
  AND A.TABLE_NAME ='EMP'

7.5.10 列出資料庫裡的所有物件

需求:查詢出給定的資料庫裡的所有物件的資訊。

解決方法:通過各個資料庫裡提供的資料物件相關的資料字典進行查詢。

SqlServer:

SELECT name,object_id,parent_object_id,type,type_desc,create_date,modify_date
FROM sys.all_objects
WHERE is_ms_shipped = 0

執行結果:

name

object_id

parent_object_id

type

type_desc

create_date

modify_date

tb_marketrecommlog

245575913

0

U

USER_TABLE

2017-03-25 15:05:20.850

2017-03-25 15:05:20.850

dept

885578193

0

U

USER_TABLE

2017-03-27 16:27:00.580

2017-03-27 16:27:00.583

PK__dept__BE2C337D15A7E7E3

901578250

885578193

PK

PRIMARY_KEY_CONSTRAINT

2017-03-27 16:27:00.580

2017-03-27 16:27:00.580

emp

917578307

0

U

USER_TABLE

2017-03-27 16:27:00.580

2017-04-19 10:17:41.640

PK__emp__AF4C318A634F478A

933578364

917578307

PK

PRIMARY_KEY_CONSTRAINT

2017-03-27 16:27:00.583

2017-03-27 16:27:00.583

FK__emp__deptno__38996AB5

949578421

917578307

F

FOREIGN_KEY_CONSTRAINT

2017-03-27 16:27:00.583

2017-03-27 16:27:00.583

salgrade

965578478

0

U

USER_TABLE

2017-03-27 16:27:00.590

2017-03-27 16:27:00.590

bonus

981578535

0

U

USER_TABLE

2017-03-27 16:27:00.593

2017-03-27 16:27:00.593

tmp_v

1557580587

0

V

VIEW

2017-04-12 10:44:00.703

2017-04-12 10:44:00.703

translate

1573580644

0

FN

SQL_SCALAR_FUNCTION

2017-04-12 10:51:52.840

2017-04-12 10:51:52.840

DF_EMP_Comm

1877581727

917578307

D

DEFAULT_CONSTRAINT

2017-04-19 09:24:14.050

2017-04-19 09:24:14.050

CK_Emp_Ename

1893581784

917578307

C

CHECK_CONSTRAINT

2017-04-19 10:17:41.640

2017-04-19 10:17:41.640

f_splitSTR

1909581841

0

TF

SQL_TABLE_VALUED_FUNCTION

2017-04-19 11:25:32.807

2017-04-19 11:25:32.807

Mysql:暫無相關檢視可以滿足此需求。

Oracle:

SELECT OBJECT_NAME,OBJECT_TYPE
FROM DBA_OBJECTS
WHERE OWNER=UPPER('SHENL')