Examples
Input: ["SET r1 name bob", "SET r1 age 2", "SET r2 name bob", "SET r2 age 10", "GET r1 name", "SELECT name bob age"]
Expected Output: ["bob", "r2 r1"]
Explanation: GET returns the stored value "bob". For SELECT, both rows match name=bob, and they are sorted by age as strings: "10" comes before "2" lexicographically, so r2 appears before r1.
Input: ["GET missing name", "SELECT status active score"]
Expected Output: ["NULL", ""]
Explanation: The table is empty. GET returns NULL, and SELECT has no matching rows so it returns an empty string.
Input: ["SET r1 city seattle", "SET r2 city seattle", "SET r2 score 9", "SELECT city seattle score", "SET r1 score 10", "SET r2 city boston", "SELECT city seattle score", "GET r2 city"]
Expected Output: ["r1 r2", "r1", "boston"]
Explanation: In the first SELECT, both rows match city=seattle. r1 is missing score, so its sort value is "", which comes before "9". After updating r2.city to boston, only r1 still matches city=seattle. The final GET returns boston.
Input: ["SET b role dev", "SET a role dev", "SET b rank mid", "SET a rank mid", "SELECT role dev rank"]
Expected Output: ["a b"]
Explanation: Both rows match role=dev and both have the same rank value "mid", so the tie is broken by rowKey ascending: a before b.
Input: ["SET r1 color red", "SET r1 color blue", "GET r1 color", "SELECT color red color", "SELECT color blue color"]
Expected Output: ["blue", "", "r1"]
Explanation: The second SET overwrites the old value red with blue. GET returns blue, SELECT for red finds no rows, and SELECT for blue returns r1.
Input: []
Expected Output: []
Explanation: With no commands, there are no outputs.