How to append a memory table to the splayed table

Hi, All

I have a splayed table:

`:/db/sp/

sp:([] sym1:symbol$(); p1:int$())

sp

sym1 p1

???

aa 1

bb 2

There is a table in memory:

t:([] sym2:symbol$(); p2:int$())

t

sym2 p2

???

cc 3

dd 4

How to append table t to splayed table sp?

sp

sym1 p1

???

aa 1

bb 2

cc 3

dd 4

Thanks a lot!

Roy

q):db/sp/ set .Q.en[:db]( sym1:aabb;p1:1 2i)

`:db/sp/

q)t:( sym2:ccdd; p2:3 4i)

q):db/sp/ upsert .Q.en[:db]sym1p1 xcol t

`:db/sp/

q)get`:db/sp/

sym1 p1


aa   1 

bb   2 

cc   3 

dd   4 

Thanks, Charles

it works!

I need to delete some records from splayed table.

DELETE operation doesn?t work.

 

delete from sp where sym1=`cc

How to do this?

you have to rewrite the whole splay, e.g.

q):db/sp/ set delete from get:db/sp where sym1=`cc

sometimes it can preferable to have an extra column which you use to mark deleted rows, and filter them on select.