You are given two tables: Variables and Expressions.
The Variables table stores variable names and their integer values. The Expressions table contains boolean expressions with left operand, operator, and right operand.
Your task is to evaluate each boolean expression by looking up the variable values and applying the given operator ('<', '>', or '=').
Return the result of each boolean expression evaluation in any order.
Table Schema
| Column Name | Type | Description |
|---|---|---|
name
PK
|
varchar | Variable name (primary key) |
value
|
int | Integer value of the variable |
| Column Name | Type | Description |
|---|---|---|
left_operand
PK
|
varchar | Left variable name in expression |
operator
PK
|
enum | Comparison operator: '<', '>', or '=' |
right_operand
PK
|
varchar | Right variable name in expression |
Input & Output
| name | value |
|---|---|
| x | 66 |
| y | 77 |
| left_operand | operator | right_operand |
|---|---|---|
| x | > | y |
| x | < | y |
| x | = | y |
| y | > | x |
| left_operand | operator | right_operand | value |
|---|---|---|---|
| x | > | y | false |
| x | < | y | true |
| x | = | y | false |
| y | > | x | true |
We evaluate each expression by looking up variable values: x=66, y=77. Then: x>y becomes 66>77=false, x<y becomes 66<77=true, x=y becomes 66=77=false, y>x becomes 77>66=true.
| name | value |
|---|---|
| a | 50 |
| b | 50 |
| left_operand | operator | right_operand |
|---|---|---|
| a | = | b |
| a | > | b |
| left_operand | operator | right_operand | value |
|---|---|---|---|
| a | = | b | true |
| a | > | b | false |
Both variables have equal values: a=50, b=50. So a=b evaluates to true, while a>b evaluates to false since 50 is not greater than 50.
Constraints
-
1 ≤ Variables.name.length ≤ 20 -
-1000 ≤ Variables.value ≤ 1000 -
operatoris one of'<','>','=' - All operands in expressions exist in Variables table