We can get MySQL dump with a where clause.

We can use below query to get selected rows from a table.

$ sudo mysqldump -u root -p dbname --where="column=columnvalue" tablename > tablename.sql;

We can use below query to get selected rows from a table with foreignkey.

$ sudo mysqldump -u root -p dbname --lock-all-tables --where="columnname in (select id from foreigntable where foreigntablecolumnname = columnvalue)" tablename > tablename.sql;