Search code examples
kdb

How do I multiple two columns of data together in kdb/q?


I am trying to teach myself kdb/q programming. I can't seem to figure out how to take a simple table (columns symbol, price, and shares) and multiply price * shares to get volume. I've read Q for Mortals, code.kx.com, etc and am stuck. Could someone please give me a hint or point me in a direction of where I could figure out this simple problem! Thanks


Solution

  • Where t is the table name:

    update volume: price*shares from t
    

    Or

    t: select symbol, price, shares, volume:price*shares from t