What query should I use to get a list of tables in a schema that don't have any rows?
To get a list of tables in a schema that have no rows, you can use the following query:
SELECT table_name FROM user_tables WHERE num_rows = 0;
This query will return the names of all tables in the current user's schema that have no rows.
If you want to get the list of tables in a different schema, you can use the ALL_TABLES view instead of USER_TABLES, and specify the schema name in the OWNER column:
SELECT table_name FROM all_tables WHERE owner = 'SCHEMA_NAME' AND num_rows = 0;
You can also use the DBA_TABLES view to get the list of tables in all schemas, but you need to have the appropriate privileges to access this view.
SELECT table_name FROM dba_tables WHERE owner = 'SCHEMA_NAME' AND num_rows = 0;
Keep in mind that the NUM_ROWS column in the USER_TABLES and ALL_TABLES views is an estimate of the number of rows in the table and may not be completely accurate. It is updated periodically by Oracle, so the actual number of rows in the table may be different from the value displayed in the view.