QUERY clause can be used in expdp or impdp to export/import subset of the data or data with specific conditions.

DEMO:

Export dump of a table from emp_tab WHERE created > sysdate -40 . Filter can be added on any column depending upon the requirement.

SQL> select count(*) from “DBACLASS”.”EMP_TAB” WHERE created > sysdate -40;

COUNT(*)
———-
1384

Create a parfile with query clause:

Now run the expdp command with parfile. We can see, 1384 rows will be exported.

Same type of conditions can be used in IMPDP also.