|
Esta consulta listou tabelas que não possuem chaves estrangeiras, o que significa que não estão referenciando nenhuma tabela ou não estão no lado "muitos"
do FK.
This query listed tables that have no foreign keys, meaning they are not referencing any table or are not on the "many" side of FK.
A consulta abaixo lista algo um pouco diferente - tabelas que não fazem referência e não são referenciadas por outras tabelas.
Algo que chamei de Tabelas dos Solitários.
Este diagrama ilustra o conceito:
Query below lists something a little different - tables that are not referencing and are not referenced by other tables.
Something I called Loner Tables.
This diagram illustrates the concept:

Consulta - Query
SELECT 'NO FKS >-' REFS
, TAB.TABSCHEMA CONCAT '.' CONCAT TAB.TABNAME AS TABLE
, '>- NO FKS' FKS
FROM SYSCAT.TABLES TAB
LEFT OUTER JOIN SYSCAT.TABCONST CONST
ON CONST.TABSCHEMA = TAB.TABSCHEMA
AND CONST.TABNAME = TAB.TABNAME AND CONST.TYPE ='F'
LEFT OUTER JOIN SYSCAT.REFERENCES REF
ON REF.REFTABSCHEMA = TAB.TABSCHEMA AND REF.REFTABNAME = TAB.TABNAME
WHERE TAB.TYPE ='T'
AND TAB.TABSCHEMA NOT LIKE 'SYS%'
AND CONST.CONSTNAME IS NULL
AND REF.CONSTNAME IS NULL
|
Colunas
- refs - ícone que simboliza a falta de referências pela chave anterior
- tabela - nome da tabela com o nome do esquema
- fks - ícone que simboliza a falta de restrições de teclas anteriores
Linhas
- Uma linha representa uma mesa
- Escopo das linhas: tabelas que não estão relacionadas (sem referência e não sendo referenciadas com restrições de chave estrangeira) com qualquer tabela
- Ordenado pelo nome da tabela de esquema
|
Columns
- refs - icon symbolizing lack of references by foregin key
- table - name of the table with schema name
- fks - icon symbolizing lack of foregin key constraints
Rows
- One row represents one table
- Scope of rows: tables that are not related (not refererencing and not being referenced with foreign key constraints) with any table
- Ordered by schema table name
|
Resultado - Sample results

Copyright © Dataedo.
|