# How to check if at least one ordering of the given row matches one of the rows of a table?

Consider some list of elements

elements={"a","k",1,"12","cdt","b","m","l","q",132,12.345,999,1000,Exp[x^2],Sin[y]};


We may make the following table

tabb = Table[Take[RandomSample[elements],4],50]


and a row

roww = Take[RandomSample[elements],4]


I have to check if roww matches at least one row of tab, now taking into account that the ordering of the elements of roww is not important. I.e., if tabb includes the row {999,1000,Exp[x^2],Sin[y]}, while roww is {1000,Sin[y],999,Exp[x^2]} then the decision should be True.

How to check if at least one ordering of roww matches with at least one row of tabb?

Edit

Probably it is ContainsOnly?

MemberQ[Sort /@ tabb, Sort[roww]]

containsInAnyOrder = Not @ FreeQ[{OrderlessPatternSequence @@ #2}] @ # &;

Or @@ Map[ContainsAll[roww], tabb]


Some examples

tabb = {{"m", Sin[y], "q", "k"}, {"q", "cdt", "m", 132}, {"12", "a", "m", "b"}, {"k", 999, 12.345, 132}};

roww = {132, "m", "q", "cdt"};

Or @@ Map[ContainsAll[roww], tabb]


True

roww = {132, "q", "q", "cdt"};

Or @@ Map[ContainsAll[roww], tabb]


True

roww = {132, "q", "-1", "cdt"};

Or @@ Map[ContainsAll[roww], tabb]


False

My attempt is as follows:

MatchesRowQ[table_, row_] := MemberQ[table, #] & /@
Permutations[row, Length[row]] // Or @@ # &


Testing MatchesRowQ:

tabb = {{"m", Sin[y], "q", "k"}, {"q", "cdt", "m", 132},
{"12", "a", "m", "b"}, {"k", 999, 12.345, 132}};

roww = {132, "m", "q", "cdt"};

MatchesRowQ[tabb, roww]

(*True*)