title: DynamoDbException: Conditions can be of length 1 or 2 only
body: <p>I am from SQL background and very new to Dynamodb. I have a single table like this:</p>
  <pre><code>-----------------------------------------------------------
   | dbId | genId | colData | deviceId | updateOn | params |
  -----------------------------------------------------------
   |      |       |         |          |          |        |
   ----------------------------------------------------------
  </code></pre>
  <p>Here <code>dbId</code> is primary key and <code>genId</code> is sort key. I have created two local secondary indexs in <code>deviceId</code> and <code>updateOn</code>. In SQL I can query from the table:</p>
  <pre><code>String dbId  = &quot;151/2020-21&quot;;
  int deviceId = 1001;
  long updOn   = 1608456211308;
  String query = &quot;select * from tableName where dbId = '&quot;+dbId+&quot;' and deviceId != &quot;+deviceId+&quot; and updateOn &gt; &quot; + updOn;
  </code></pre>
  <p>In DynamoDb my keyConditionExpression is : <code>dbId = :dbId and updateOn &gt; :updateOn and deviceId != :deviceId</code>. It gives me error :</p>
  <pre><code>DynamoDbException: Invalid KeyConditionExpression: Syntax error; token: &quot;!&quot;, near: &quot;deviceId !=&quot;
  </code></pre>
  <p>I removed the <code>'!'</code> to this : <code>dbId = :dbId and updateOn &gt; :updateOn and deviceId = :deviceId</code>. It gives me error:</p>
  <pre><code>DynamoDbException: Conditions can be of length 1 or 2 only
  </code></pre>
  <p>How can I perform my desired query in Dynamodb? How should I design my Dynamodb table (I mean, primary key, indexes etc) so that I get the same sql like result?</p>