Build a tiny in-memory database engine exposed through a single driver function run_db(operations). The function receives a list of operations and must execute them in order, returning a list that contains one result for every select operation (in the order they appear).
Each operation is a tuple:
- ("create", table_name, schema) where schema is a list of column names. Creates an empty table with the given ordered columns.
- ("insert", table_name, values) where values is a list of column values aligned with the table schema. Appends one row.
- ("select", table_name, columns, where) or ("select", table_name, columns, where, order_by).
For a select:
- columns is a list of column names to project, or the single-element list ["*"] meaning every column in schema order.
- where is a predicate (see below) or None (no filtering).
- order_by, when present, is a tuple (column_name, direction) where direction is "asc" or "desc".
A predicate is one of:
- (op, column, value) where op is one of "=", "!=", "<", ">", "<=", ">=".
- ("and", pred_a, pred_b)
- ("or", pred_a, pred_b)
- None (matches every row).
Each select result is a list of rows, and each row is a list of the projected values in the requested column order. Rows are returned in insertion order unless order_by is provided. run_db returns the list of all select results.