Select Columns
EasyData EngineeringSortingMatrixSQL
Description
Given a 2D table and a list of column indices, return a new table keeping only those columns, in the given order (a projection).
Examples
Input:
[[1,2,3],[4,5,6]], [0,2]Output:
[[1,3],[4,6]]Explanation:
Only the requested columns are kept, reordered to match the order in which their indices were given.
Input:
[[1,2],[3,4]], [1]Output:
[[2],[4]]Explanation:
Only the requested columns are kept, reordered to match the order in which their indices were given.
Input:
[[9,8,7]], [2,0]Output:
[[7,9]]Explanation:
Only the requested columns are kept, reordered to match the order in which their indices were given.
Constraints
- •
1 ≤ rows ≤ 10⁴