Home > database >  There are a lot of table, I want to find which tables are not how to write SQL database?
There are a lot of table, I want to find which tables are not how to write SQL database?

Time:12-15

There are a lot of table, I want to find how to find which of the following table is not in the database? This writing is to find the existence of table
Select * from tabs WHERE table_name IN (' the USERINFO '
.
'USERGROUP')

CodePudding user response:

First of all, you have to have a list, you need to query table
For example, you need to query TABLE_NAME_1 TABLE_NAME_2, TABLE_NAME_3, the existence of the three tables and
You can write so

SELECT * FROM (
SELECT 'TABLE_NAME_1' S FROM DUAL UNION ALL
SELECT 'TABLE_NAME_2' S FROM DUAL UNION ALL
SELECT 'TABLE_NAME_3' S FROM DUAL) T
WHERE T.S NOT IN (SELECT TABLE_NAME FROM USER_TABLES)
  • Related