title: Retrieve selected data from DynamoDB local in java
body: <p>I have created a table in my local dynamoDB. The fields are,</p>
  
  <pre><code>id (N)
  name (S)
  school (S)
  classname (S)
  </code></pre>
  
  <p>Now I want to retrieve all the records for which school equals to "xschool" and print.</p>
  
  <p>Tried the below code but it gives me an error in the query,</p>
  
  <pre><code>QuerySpec spec = new QuerySpec().withProjectionExpression("sid, classname, school")
              .withKeyConditionExpression("school = :v_school").
              withValueMap(new ValueMap().withString(":v_school", "abcschool"));
  
          ItemCollection&lt;QueryOutcome&gt; items = table.query(spec);
  
          Iterator&lt;Item&gt; iterator = items.iterator();
  
          while (iterator.hasNext()) {
              System.out.println(iterator.next().toJSONPretty());
          }
  </code></pre>
  
  <p>Any suggestions for this as I'm new to dynamoDB. </p>