Need clarification on appending single record using concatenation operator

Hi Team,

On How to work with tables - KDB-X Documentation , we have example of appending single row to a table as below:

t:([] name: `Alice`Bob`Mike; phone: ("555-0101"; "555-0723"; "555-6666"); age: 23 32 22);

t,:(`John; "555-5382"; 40) / append a single row & this works with appends to a list in place

Above example works but why belwo elaborated example does not work.

t:([] name: `Alice`Bob`Mike; phone: ("555-0101"; "555-0723"; "555-6666"); age: 23 32 22);

t: t,(`John; "555-5382"; 40) /This give incorrect result with concat & then assign operation

Can somebody please give explaination on this behaviour with KDB-X ?

Thanks,

Vajindar Laddad

Hi All, Any clarification on this , please..

–

1 Answer

1

Hi Vajindar,

The behavior of x,:y and x:x,y are not always the same. For example, x,:y supports appending a record from a list while x,y doesn't.

More details here:

Join atoms, lists, dictionaries or tables | Reference | KDB-X and q documentation - KDB-X Documentation

I updated https://code.kx.com/kdb-x/how_to/basics/data_structures/tables.html#appending-records to be more explicit.

–